From fb8998656c77686c5f73315bb03a76d3e0114074 Mon Sep 17 00:00:00 2001 From: yosh Date: Thu, 25 Jan 2024 00:44:48 -0500 Subject: [PATCH] vodarchive: better --- twitch-vodarchive | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/twitch-vodarchive b/twitch-vodarchive index fcb8c96..aae716b 100755 --- a/twitch-vodarchive +++ b/twitch-vodarchive @@ -1,9 +1,25 @@ #!/bin/sh set -euf -filename="$(yt-dlp -O '%(upload_date>%Y-%m-%d)s %(title)s.%(ext)s' "$1")" -yt-dlp -o "$filename" "$1" - -for ext in json html txt; do - twitchdownloader chatdownload -o "${filename%.*}.$ext" -u "$1" +while getopts :vcq: OPT; do + case "$OPT" in + v) novod=1 ;; + c) nochat=1 ;; + q) quality=$OPTARG ;; + *) exit 1 ;; + esac +done +shift $((OPTIND - 1)) + +for url; do + filename="$(yt-dlp -O '%(upload_date>%Y-%m-%d)s %(title)s.%(ext)s' "$url")" + if [ -z "${novod:-}" ]; then + yt-dlp ${quality:+-f "$quality"} -o "$filename" "$url" + fi + + if [ -z "${nochat:-}" ]; then + for ext in json html txt; do + twitchdownloader chatdownload -o "${filename%.*}.$ext" -u "$url" + done + fi done