rename/download filename fix, shell duration fix.
This commit is contained in:
@@ -39,7 +39,7 @@ async def down_load(bot: BOT, message: Message):
|
||||
)
|
||||
else:
|
||||
if "-f" in message.flags:
|
||||
file_name, url = message.flt_input.split()
|
||||
file_name, url = message.flt_input.split(maxsplit=1)
|
||||
else:
|
||||
url = message.flt_input
|
||||
dl_obj: Download = await Download.setup(
|
||||
|
||||
@@ -22,9 +22,9 @@ async def rename(bot: BOT, message: Message):
|
||||
"""
|
||||
input = message.flt_input
|
||||
response = await message.reply("Checking input...")
|
||||
if (not message.replied or not message.replied.media) and not message.flt_input:
|
||||
if not message.replied or not message.replied.media or not message.flt_input:
|
||||
await response.edit(
|
||||
"Invalid input...\nReply to a message containing media or give a link and filename with cmd."
|
||||
"Invalid input...\nReply to a message containing media or give a link and a filename with cmd."
|
||||
)
|
||||
return
|
||||
dl_path = os.path.join("downloads", str(time.time()))
|
||||
@@ -37,7 +37,7 @@ async def rename(bot: BOT, message: Message):
|
||||
response=response,
|
||||
)
|
||||
else:
|
||||
url, file_name = input.split()
|
||||
url, file_name = input.split(maxsplit=1)
|
||||
dl_obj: Download = await Download.setup(
|
||||
url=url, path=dl_path, message_to_edit=response, custom_file_name=file_name
|
||||
)
|
||||
|
||||
@@ -21,14 +21,14 @@ async def take_ss(video: str, path: str) -> None | str:
|
||||
|
||||
async def check_audio(file) -> int:
|
||||
result = await run_shell_cmd(
|
||||
f"ffprobe -v error -show_entries format=nb_streams -of default=noprint_wrappers=1:nokey=1 {file}"
|
||||
f'''ffprobe -v error -show_entries format=nb_streams -of default=noprint_wrappers=1:nokey=1 "{file}"'''
|
||||
)
|
||||
return int(result or 0) - 1
|
||||
|
||||
|
||||
async def get_duration(file) -> int:
|
||||
duration = await run_shell_cmd(
|
||||
f"""ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {file}"""
|
||||
f'''ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "{file}"'''
|
||||
)
|
||||
return round(float(duration.strip() or 0))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user