Added possibility to download stuff once

This commit is contained in:
Leonetienne 2022-02-04 15:15:59 +01:00
parent c710e4b892
commit 9b6e9fc7a6
5 changed files with 46 additions and 3 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
/music/
/videos/
/linklist-*.txt
/alreadydownloaded-*.txt
/alreadydownloaded*.txt
/once.yaml

42
download-once.py Normal file
View 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.")

View File

@ -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

View File

@ -1,2 +1,2 @@
./download-videos.sh
./download-mp3.sh
./download-music.sh