change saving path and error logging
This commit is contained in:
parent
7237cb8da9
commit
fe3993bda8
2 changed files with 5 additions and 5 deletions
|
|
@ -20,9 +20,9 @@ class YoutubeDL(BotBaseCog):
|
|||
video_or_audio = ctx.message.content.split(" ")[2]
|
||||
process = subprocess.Popen(["python3", "data/ytdl/youtubedl.py", url, video_or_audio])
|
||||
process.wait()
|
||||
logging.info(process.stdout.read())
|
||||
logging.info(process.stderr.read())
|
||||
logging.info(process.returncode)
|
||||
logging.error(process.stdout.read())
|
||||
logging.error(process.stderr.read())
|
||||
logging.error(process.returncode)
|
||||
await ctx.send(f"Downloading {video_or_audio} from {url}...", suppress_embeds=True)
|
||||
except:
|
||||
await ctx.send("Usage: !youtubedl <url> <video|audio>")
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ import subprocess
|
|||
|
||||
def download(url, video_or_audio):
|
||||
if video_or_audio == "video":
|
||||
process = subprocess.Popen(["yt-dlp", "-o", "%(playlist|)s/%(playlist_index)s - %(title)s.%(ext)s", "--yes-playlist", f"{url}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
process = subprocess.Popen(["yt-dlp", "-o", "data/ytdl/%(playlist|)s/%(playlist_index)s - %(title)s.%(ext)s", "--yes-playlist", f"{url}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
print(process.stdout.read())
|
||||
process.wait()
|
||||
return True
|
||||
elif video_or_audio == "audio":
|
||||
process = subprocess.Popen(["yt-dlp", "-o", "%(playlist|)s/%(playlist_index)s - %(title)s.%(ext)s", "-x", "--yes-playlist", f"{url}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
process = subprocess.Popen(["yt-dlp", "-o", "data/ytdl/%(playlist|)s/%(playlist_index)s - %(title)s.%(ext)s", "-x", "--yes-playlist", f"{url}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
print(process.stdout.read())
|
||||
process.wait()
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue