Skip to content

Commit

Permalink
Support more namings and subtitles
Browse files Browse the repository at this point in the history
  • Loading branch information
bugale committed Jan 27, 2024
1 parent 97de81e commit 3053c83
Show file tree
Hide file tree
Showing 5 changed files with 812 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**\__pycache__
**/__pycache__
.vscode/launch.json
2 changes: 2 additions & 0 deletions buganime/buganime.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def _get_subtitle_stream_index() -> int:
if all(x not in stream['tags'].get('title', '').upper() for x in ('S&S', 'SIGNS', 'FORCED')):
relevant_streams.append((i, stream))
if not relevant_streams:
if len(subtitle_streams) == 1:
return 0
raise RuntimeError('No English subtitle stream found')
if len(relevant_streams) == 1:
return relevant_streams[0][0]
Expand Down
2 changes: 1 addition & 1 deletion buganime/transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, input_path: str, output_path: str, height_out: int, video_inf
self.__input_path, self.__output_path = input_path, output_path
self.__video_info = video_info
self.__height_out = height_out
self.__width_out = int(self.__video_info.width * self.__height_out / self.__video_info.height)
self.__width_out = round(self.__video_info.width * self.__height_out / self.__video_info.height)
model = Transcoder.Module(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=16, upscale=4)
model.load_state_dict(torch.load(MODEL_PATH)['params'], strict=True)
self.__model = model.eval().cuda().half()
Expand Down
Loading

0 comments on commit 3053c83

Please sign in to comment.