Skip to content

Commit

Permalink
Use shlex split to cover all cases in ffmpeg_cmds
Browse files Browse the repository at this point in the history
fix anasty17#1806

Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Jan 14, 2025
1 parent 963d587 commit 58fb3dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion bot/helper/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from aioshutil import move, rmtree
from pyrogram.enums import ChatAction
from re import sub, I
from shlex import split

from .. import (
user_data,
Expand Down Expand Up @@ -610,7 +611,7 @@ async def proceed_extract(self, dl_path, gid):
async def proceed_ffmpeg(self, dl_path, gid):
checked = False
cmds = [
[part.strip() for part in item.split() if part.strip()]
[part.strip() for part in split(item) if part.strip()]
for item in self.ffmpeg_cmds
]
try:
Expand Down
11 changes: 8 additions & 3 deletions bot/helper/ext_utils/media_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from PIL import Image
from aiofiles.os import remove, path as aiopath, makedirs
from asyncio import create_subprocess_exec, create_subprocess_shell, gather, wait_for, sleep
from asyncio import (
create_subprocess_exec,
gather,
wait_for,
sleep,
)
from asyncio.subprocess import PIPE
from os import path as ospath, cpu_count
from re import search as re_search, escape
Expand Down Expand Up @@ -420,8 +425,8 @@ async def ffmpeg_cmds(self, ffmpeg, f_path):
ffmpeg[index] = output
if self._listener.is_cancelled:
return False
self._listener.subproc = await create_subprocess_shell(
(" ").join(ffmpeg), stdout=PIPE, stderr=PIPE
self._listener.subproc = await create_subprocess_exec(
*ffmpeg, stdout=PIPE, stderr=PIPE
)
await self._ffmpeg_progress()
_, stderr = await self._listener.subproc.communicate()
Expand Down

0 comments on commit 58fb3dd

Please sign in to comment.