Initial commit.

- brief readme
- initial working commit of the youtube-dl script i use
master
jowj 5 years ago
commit ca0f98ecec

@ -0,0 +1,40 @@
import os
import argparse
import subprocess
import shutil
from pathlib import Path
if __name__ == '__main__':
MUSIC_DEST =
VIDEO_DEST =
PARSER = argparse.ArgumentParser()
PARSER.add_argument('-t', '--type', help="aud or vid?", type=str)
PARSER.add_argument('-u', '--url', help="link?", type=str)
ARGS = PARSER.parse_args()
TEMP_PATH = os.getcwd() + '/temp'
os.mkdir(TEMP_PATH)
os.chdir(TEMP_PATH)
if ARGS.type == 'music':
# this will download a video an convert to just mp3
URL = ARGS.url
DEST_ROOT = MUSIC_DEST
subprocess.call(["youtube-dl", "-i", "--extract-audio",
"--audio-format", "mp3", "--yes-playlist",
"-o", "%(playlist_title)s/%(title)s.%(ext)s",
URL])
if ARGS.type == 'video':
# this actually downloads the videos in a playlist to seperate files.
URL = ARGS.url
DEST_ROOT = VIDEO_DEST
subprocess.call(["youtube-dl", "-i", "-f"
"mp4", "-o", "%(playlist_title)s/%(title)s.%(ext)s",
URL])
PLAYLIST = os.listdir(".")
DEST = DEST_ROOT + "/" + PLAYLIST[0]
shutil.move(PLAYLIST[0], DEST)
os.rmdir(TEMP_PATH)

@ -0,0 +1,13 @@
# utils
this repo houses some random shit i wrote that does stuff for me. almost no one will want this stuff.
## dwim-youtube-dl
youtube-dl is fucking amazing. its one of the coolest / most useful things maintained by oss people that regular, normal humans see. but it doesn't do what i want it to do out of the box.
### features
- infer if the item given is part of a playlist or not
- if its in a playlist, each file downloaded goes in a folder named after the playlist
- if its not a playlist..what should happen?
- declare a flag that determines what library the target should go to
- video vs audio, etc
Loading…
Cancel
Save