From 9c9fb37a0e10960aa57f292b3f5f5cdcc385f980 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Tue, 23 Jun 2020 13:29:13 -0600 Subject: [PATCH] c --- README.md | 4 ++++ automated-youtube-dl.py | 9 +++++---- pip-update.sh | 2 ++ start.sh | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 pip-update.sh create mode 100644 start.sh diff --git a/README.md b/README.md index 9c99b41..ed4515a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ Download, compress, and send your YouTube videos. 3. Install jq 1. `sudo apt-get install jq` + +4. Install ffmpeg + + 1. `sudo apt install ffmpeg` ### Usage diff --git a/automated-youtube-dl.py b/automated-youtube-dl.py index c06abd9..b4be405 100644 --- a/automated-youtube-dl.py +++ b/automated-youtube-dl.py @@ -67,6 +67,8 @@ fh.setFormatter(formatter) logging.StreamHandler(stream=sys.stderr) logger.addHandler(fh) +os.system('youtube-dl --rm-cache-dir') + # since youtube-dl updates so much check for updates # if not args.no_update: # print('checking for updates...') @@ -135,7 +137,7 @@ def checkSize(url): def getUrls(playlist): proc = subprocess.run(['bash', 'get-urls.sh', playlist], capture_output=True, encoding="utf-8") if proc.stdout == '': - logger.error('missing get-urls.sh') + logger.error('') print('missing get-urls.sh') sys.exit(1) if proc.stdout.find('get-urls.sh: line 1: jq: command not found') == -1: @@ -194,7 +196,7 @@ ydl_opts = { 'allsubtitles': True, 'logtostderr': True, 'format': ytdlFormat, - 'outtmpl': 'downloads/%(title)s - %(id)s.%(ext)s', + 'outtmpl': 'downloads/\'%(title)s\' - (\'%(uploader)s\' - \'%(uploader_id)s\') - %(id)s', 'postprocessors': [{ 'key': 'FFmpegMetadata', 'key': 'EmbedThumbnail', @@ -203,8 +205,7 @@ ydl_opts = { 'logger': ytdlLogger(), 'progress_hooks': [my_hook], } -ytdlCMD = 'youtube-dl -i --add-metadata --all-subs --embed-subs --embed-thumbnail -f "{}" --merge-output-format mkv -o "downloads/%(title)s - %(id)s.%(ext)s" --write-annotations --write-info-json --write-description --write-all-thumbnails --write-sub --sub-format "best" --geo-bypass'.format( - ytdlFormat) +ytdlCMD = 'youtube-dl -i --add-metadata --all-subs --embed-subs --embed-thumbnail -f "{}" --merge-output-format mkv -o "downloads/%(title)s - %(id)s.%(ext)s" --write-annotations --write-info-json --write-description --write-all-thumbnails --write-sub --sub-format "best" --geo-bypass'.format(ytdlFormat) videoInc = 1 if not isURL: diff --git a/pip-update.sh b/pip-update.sh new file mode 100644 index 0000000..f69f734 --- /dev/null +++ b/pip-update.sh @@ -0,0 +1,2 @@ +#!/bin/bash +pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..8605a18 --- /dev/null +++ b/start.sh @@ -0,0 +1,2 @@ +#!/bin/bash +python3 automated-youtube-dl.py https://www.youtube.com/playlist?list=PLTzznpqMc2tWxCHJYQ7mr7-6M_ZwzXIGW