Skip to content

Commit

Permalink
Dynamic outputs in ffmpeg_cmds
Browse files Browse the repository at this point in the history
- like mltb-2.srt or mltb643 or mltb or mltb334534.srt or mltb.srt

Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Jan 15, 2025
1 parent 612b353 commit 790e951
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bot/helper/ext_utils/media_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,18 @@ async def ffmpeg_cmds(self, ffmpeg, f_path):
for index in indices:
output_file = ffmpeg[index]
if output_file != "mltb" and output_file.startswith("mltb"):
oext = ospath.splitext(output_file)[-1]
if ext == oext:
base_name = f"ffmpeg{index}.{base_name}"
bo, oext = ospath.splitext(output_file)
if oext:
if ext == oext:
prefix = f"ffmpeg{index}." if bo == "mltb" else ""
else:
prefix = ""
ext = ""
else:
ext = oext
prefix = ""
else:
base_name = f"ffmpeg{index}.{base_name}"
output = f"{dir}/{base_name}{ext}"
prefix = f"ffmpeg{index}."
output = f"{dir}/{prefix}{output_file.replace("mltb", base_name)}{ext}"
outputs.append(output)
ffmpeg[index] = output
if self._listener.is_cancelled:
Expand Down

0 comments on commit 790e951

Please sign in to comment.