changed youtubedl.py to just assume cwd is wrong
This commit is contained in:
parent
8fb5f1bee8
commit
73679351d3
2 changed files with 5 additions and 6 deletions
|
|
@ -16,9 +16,8 @@ class YoutubeDL(BotBaseCog):
|
||||||
url = ctx.message.content.split(" ", 1)[1]
|
url = ctx.message.content.split(" ", 1)[1]
|
||||||
url = '"' + url + '"'
|
url = '"' + url + '"'
|
||||||
video_or_audio = ctx.message.content.split(" ", 2)[2]
|
video_or_audio = ctx.message.content.split(" ", 2)[2]
|
||||||
working_dir = f"{os.getcwd()}/data/ytdl/"
|
process = subprocess.Popen(["python3", "data/ytdl/youtubedl.py", url, video_or_audio])
|
||||||
process = subprocess.Popen(["python3", "data/ytdl/youtubedl.py", url, video_or_audio], cwd=working_dir)
|
await ctx.send(f"Downloading {video_or_audio} from {url}...", suppress_embeds=True)
|
||||||
await ctx.send(f"Downloading {video_or_audio} from {url}...", embeds=None)
|
|
||||||
except:
|
except:
|
||||||
await ctx.send("Usage: !youtubedl <url> <video|audio>")
|
await ctx.send("Usage: !youtubedl <url> <video|audio>")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ import subprocess
|
||||||
|
|
||||||
def download(url, video_or_audio):
|
def download(url, video_or_audio):
|
||||||
if video_or_audio == "video":
|
if video_or_audio == "video":
|
||||||
process = subprocess.Popen(["yt-dlp", "--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())
|
print(process.stdout.read())
|
||||||
process.wait()
|
process.wait()
|
||||||
return True
|
return True
|
||||||
elif video_or_audio == "audio":
|
elif video_or_audio == "audio":
|
||||||
process = subprocess.Popen(["yt-dlp", "-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())
|
print(process.stdout.read())
|
||||||
process.wait()
|
process.wait()
|
||||||
return True
|
return True
|
||||||
|
|
@ -23,7 +23,7 @@ def zip_all_files():
|
||||||
#zip all files
|
#zip all files
|
||||||
current_epoch = time.time()
|
current_epoch = time.time()
|
||||||
output_file = f"{current_epoch}.zip"
|
output_file = f"{current_epoch}.zip"
|
||||||
os.system(f"zip -r {output_file} *")
|
os.system(f"zip -r {output_file} data/ytdl/*")
|
||||||
return output_file
|
return output_file
|
||||||
|
|
||||||
def upload_to_litterbox(input_file):
|
def upload_to_litterbox(input_file):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue