Skip to content

Commit

Permalink
Quote bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AbirHasan2005 authored Feb 23, 2022
1 parent 507995f commit 48a0303
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bot/plugins/video_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import time
import json
import shlex
from bot.client import (
Client
)
Expand Down Expand Up @@ -67,7 +68,7 @@ async def video_info_handler(c: Client, m: Message):
)
)
await editable.edit("Trying to Fetch Media Data ...")
output = await execute(f"ffprobe -hide_banner -show_streams -print_format json '{the_media}'")
output = await execute(f"ffprobe -hide_banner -show_streams -print_format json {shlex.quote(the_media)}")
if not output:
try:
os.remove(the_media)
Expand All @@ -78,7 +79,7 @@ async def video_info_handler(c: Client, m: Message):

try:
details = json.loads(output[0])
middle_cmd = f"ffmpeg -i '{the_media}' -c copy -map 0"
middle_cmd = f"ffmpeg -i {shlex.quote(the_media)} -c copy -map 0"
if title:
middle_cmd += f' -metadata title="{title}"'
for stream in details["streams"]:
Expand All @@ -94,7 +95,7 @@ async def video_info_handler(c: Client, m: Message):
str(time.time()).replace(".", "") + "/"
if not os.path.isdir(dl_loc):
os.makedirs(dl_loc)
middle_cmd += f" '{dl_loc}{new_file_name}'"
middle_cmd += f" {shlex.quote(dl_loc + new_file_name)}"
await editable.edit("Please Wait ...\n\nProcessing Video ...")
output = await execute(middle_cmd)
print(output, flush=True)
Expand Down

0 comments on commit 48a0303

Please sign in to comment.