From 7c606f86c88ca92bc6500177b628253067986f7e Mon Sep 17 00:00:00 2001 From: sc-idevops Date: Sun, 21 May 2023 00:40:54 -0400 Subject: [PATCH] fixed logic in folder creation --- scripts/server_bin/twitch_fullArchive.sh | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/server_bin/twitch_fullArchive.sh b/scripts/server_bin/twitch_fullArchive.sh index e26b053..914c677 100755 --- a/scripts/server_bin/twitch_fullArchive.sh +++ b/scripts/server_bin/twitch_fullArchive.sh @@ -1,8 +1,11 @@ #!/bin/bash -if [[ -z "$2" ]]; then - echo "please provide both parameters" - exit 1 -fi +help() +{ + echo "Download all the past broadcasts from a twitch user" + echo "Requires 2 Parameters:" + echo " -u the username of the twitch user" + echo " -f the encoding format for the videos, which are fed to yt-dlp" +} while getopts u:f: flag do case "${flag}" in @@ -11,15 +14,11 @@ do h) help exit;; esac done +if [[ -z "$2" ]]; then + echo "please provide both parameters" + exit 1 +fi -cd /home/stev/Videos/Twitch/$username || mkdir -v ~/Videos/Twitch/$username +cd /home/stev/Videos/Twitch/$username || mkdir -v ~/Videos/Twitch/$username && cd ~/Videos/Twitch/$username yt-dlp -q -f $format "https://www.twitch.tv/$username/videos?filter=archives&sort=time" - -help() -{ - echo "Download all the past broadcasts from a twitch user" - echo "Requires 2 Parameters:" - echo " -u the username of the twitch user" - echo " -f the encoding format for the videos, which are fed to yt-dlp" -}