From b4b1b6394dbabe6bcb233abc396eba1ce8af08e5 Mon Sep 17 00:00:00 2001 From: lulzette Date: Sat, 24 Apr 2021 09:29:18 +0300 Subject: [PATCH] single config --- check.sh | 10 +++++----- config_list.sh.template | 2 +- config_python.py.template | 2 -- lifeChk.py | 7 +++---- 4 files changed, 9 insertions(+), 12 deletions(-) delete mode 100644 config_python.py.template diff --git a/check.sh b/check.sh index deb592e..1221138 100755 --- a/check.sh +++ b/check.sh @@ -11,17 +11,17 @@ source $full_path/config_list.sh #check if not running, kill if running and stream is finished (broken record) # [ -f $storage_path/$1/pid ] && $full_path/lifeChk.py $1 && exit 0 || kill -9 $(cat $storage_path/$1/pid) -[ -f $storage_path/$1/pid ] && $full_path/lifeChk.py $1 && exit 0 + +#if pid exists and stream is live, than exit and do not start recording +[ -f $storage_path/$1/pid ] && $full_path/lifeChk.py $1 $twitchid && exit 0 #exit if no stream -$full_path/lifeChk.py $1 || exit 0 +$full_path/lifeChk.py $1 $twitchid || exit 0 # echo `$full_path/lifeChk.py $1` -#set pid and start downloading +#set pid and start recording echo $! > $storage_path/$1/pid /home/losted/.local/bin/youtube-dl -v -o $storage_path/$1/"%(upload_date)s_%(title)s__%(timestamp)s_%(id)s.%(ext)s" twitch.tv/$1 >> $storage_path/$1/youtube-dl.log 2>&1 - #remove pid - rm $storage_path/$1/pid diff --git a/config_list.sh.template b/config_list.sh.template index 7f63e44..362e959 100644 --- a/config_list.sh.template +++ b/config_list.sh.template @@ -4,7 +4,7 @@ ########### list="jesusavgn" - +twitchid="123456789qwertyuiops" storage_path="/media/nfs/twitch/automatedRecording" ytdl_path="/home/ubuntu/.local/bin" ytdl_conf="-o %(uploader)s__%(upload_date)s_%(timestamp)s__%(title)s_%(id)s.%(ext)s" diff --git a/config_python.py.template b/config_python.py.template deleted file mode 100644 index dcc99a6..0000000 --- a/config_python.py.template +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/python3 -twitchid="" \ No newline at end of file diff --git a/lifeChk.py b/lifeChk.py index 525a8cf..aaf7e16 100755 --- a/lifeChk.py +++ b/lifeChk.py @@ -3,13 +3,12 @@ # return 0 if streamer is live (continue execution while in bash), 1 if not ################# import sys -import config_python -#if not sys.argv[1]: -# sys.exit(2) +if (not sys.argv[1]) or (not sys.argv[2]): + sys.exit(2) from twitch import TwitchClient -client = TwitchClient(client_id=config_python.twitchid) #client init +client = TwitchClient(client_id=sys.argv[2]) #client init user_id=client.users.translate_usernames_to_ids(sys.argv[1])[0].id #get id #get live by id (if var not empty)