Skip to content

Commit

Permalink
Fix ffmpeg cmd list edit
Browse files Browse the repository at this point in the history
Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Dec 2, 2024
1 parent f1a8a5e commit 4f343c7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bot/helper/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1121,14 +1121,14 @@ async def substitute(self, dl_path):
async def proceed_ffmpeg(self, dl_path, gid):
checked = False
for ffmpeg_cmd in self.ffmpeg_cmds:
if "-del" in ffmpeg_cmd:
ffmpeg_cmd.remove("-del")
cmd = ["ffmpeg"] + ffmpeg_cmd
if "-del" in cmd:
cmd.remove("-del")
delete_files = True
else:
delete_files = False
ffmpeg_cmd.insert(0, "ffmpeg")
index = ffmpeg_cmd.index("-i")
input_file = ffmpeg_cmd[index + 1]
index = cmd.index("-i")
input_file = cmd[index + 1]
if input_file.endswith(".video"):
ext = "video"
elif input_file.endswith(".audio"):
Expand Down Expand Up @@ -1159,8 +1159,8 @@ async def proceed_ffmpeg(self, dl_path, gid):
task_dict[self.mid] = FFmpegStatus(self, gid)
await cpu_eater_lock.acquire()
LOGGER.info(f"Running ffmpeg cmd for: {file_path}")
ffmpeg_cmd[index + 1] = file_path
res = await run_ffmpeg_cmd(self, ffmpeg_cmd, file_path)
cmd[index + 1] = file_path
res = await run_ffmpeg_cmd(self, cmd, file_path)
if res and delete_files:
await remove(file_path)
else:
Expand All @@ -1181,14 +1181,14 @@ async def proceed_ffmpeg(self, dl_path, gid):
continue
elif ext != "all" and not f_path.endswith(ext):
continue
ffmpeg_cmd[index + 1] = f_path
cmd[index + 1] = f_path
if not checked:
checked = True
async with task_dict_lock:
task_dict[self.mid] = FFmpegStatus(self, gid)
await cpu_eater_lock.acquire()
LOGGER.info(f"Running ffmpeg cmd for: {f_path}")
res = await run_ffmpeg_cmd(self, ffmpeg_cmd, f_path)
res = await run_ffmpeg_cmd(self, cmd, f_path)
if res and delete_files:
await remove(f_path)
if checked:
Expand Down

0 comments on commit 4f343c7

Please sign in to comment.