Added possibility to download stuff once
This commit is contained in:
parent
c710e4b892
commit
9b6e9fc7a6
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
/music/
|
||||
/videos/
|
||||
/linklist-*.txt
|
||||
/alreadydownloaded-*.txt
|
||||
/alreadydownloaded*.txt
|
||||
/once.yaml
|
42
download-once.py
Normal file
42
download-once.py
Normal file
@ -0,0 +1,42 @@
|
||||
# This script is for downloading stuff ONCE. This is for, let's say, playlists that will never change again that you want to download.
|
||||
import yaml
|
||||
import os
|
||||
|
||||
with open("once.yaml", "r") as yamlfile:
|
||||
try:
|
||||
config = yaml.safe_load(yamlfile)
|
||||
|
||||
for entry in config:
|
||||
print(f"\033[92mGrabbing {entry['type']} '{entry['url']}':")
|
||||
|
||||
if entry["type"] == "music":
|
||||
os.system(f"""
|
||||
yt-dlp
|
||||
-c
|
||||
--extract-audio
|
||||
--audio-format mp3
|
||||
-o 'music/{entry['folder-name']}/%(title)s.%(ext)s'
|
||||
--extractor-args youtube:player_client=android
|
||||
--throttled-rate 100M
|
||||
--restrict-filenames
|
||||
--download-archive alreadydownloadedonce-music.txt
|
||||
'{entry['url']}'
|
||||
""".replace('\n', " ")
|
||||
)
|
||||
|
||||
elif entry["type"] == "video" or entry["type"] == "videos":
|
||||
os.system(f"""
|
||||
yt-dlp
|
||||
-c
|
||||
--merge-output-format mkv
|
||||
-o 'videos/{entry['folder-name']}/%(title)s.%(ext)s'
|
||||
--extractor-args youtube:player_client=android
|
||||
--throttled-rate 100M
|
||||
--restrict-filenames
|
||||
--download-archive alreadydownloadedonce-videos.txt
|
||||
'{entry['url']}'
|
||||
""".replace('\n', " ")
|
||||
)
|
||||
|
||||
except yaml.YAMLError as exc:
|
||||
print("You fucked up the yaml format.")
|
@ -6,4 +6,4 @@ yt-dlp \
|
||||
--extractor-args youtube:player_client=android \
|
||||
--throttled-rate 100M \
|
||||
--restrict-filenames \
|
||||
--download-archive alreadydownloaded-video.txt
|
||||
--download-archive alreadydownloaded-videos.txt
|
||||
|
@ -1,2 +1,2 @@
|
||||
./download-videos.sh
|
||||
./download-mp3.sh
|
||||
./download-music.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user