Skip to content

Commit

Permalink
check if mkv in output folder, if not move srts to output folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cbusillo committed Jun 21, 2024
1 parent 0eb3a0a commit b2846d2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bd_to_avp/modules/sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def extract_subtitle_to_srt(mkv_path: Path, output_path: Path) -> None:

pgsrip.rip(mkv_file, sub_options)

if mkv_path.parent != output_path:
glob_pattern = f"{mkv_path.stem}*.srt"
for srt_file in mkv_path.parent.glob(glob_pattern):
srt_file.rename(output_path / srt_file.name)

for srt_file in output_path.glob("*.srt"):
if srt_file.stat().st_size == 0:
srt_file.unlink()
Expand Down

0 comments on commit b2846d2

Please sign in to comment.