single config

This commit is contained in:
lulzette 2021-04-24 09:29:18 +03:00
parent 9b10d35eb6
commit b4b1b6394d
4 changed files with 9 additions and 12 deletions

View File

@ -11,17 +11,17 @@ source $full_path/config_list.sh
#check if not running, kill if running and stream is finished (broken record) #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 || 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 #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` # echo `$full_path/lifeChk.py $1`
#set pid and start downloading #set pid and start recording
echo $! > $storage_path/$1/pid 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 /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 #remove pid
rm $storage_path/$1/pid rm $storage_path/$1/pid

View File

@ -4,7 +4,7 @@
########### ###########
list="jesusavgn" list="jesusavgn"
twitchid="123456789qwertyuiops"
storage_path="/media/nfs/twitch/automatedRecording" storage_path="/media/nfs/twitch/automatedRecording"
ytdl_path="/home/ubuntu/.local/bin" ytdl_path="/home/ubuntu/.local/bin"
ytdl_conf="-o %(uploader)s__%(upload_date)s_%(timestamp)s__%(title)s_%(id)s.%(ext)s" ytdl_conf="-o %(uploader)s__%(upload_date)s_%(timestamp)s__%(title)s_%(id)s.%(ext)s"

View File

@ -1,2 +0,0 @@
#!/usr/bin/python3
twitchid=""

View File

@ -3,13 +3,12 @@
# return 0 if streamer is live (continue execution while in bash), 1 if not # return 0 if streamer is live (continue execution while in bash), 1 if not
################# #################
import sys import sys
import config_python if (not sys.argv[1]) or (not sys.argv[2]):
#if not sys.argv[1]: sys.exit(2)
# sys.exit(2)
from twitch import TwitchClient 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 user_id=client.users.translate_usernames_to_ids(sys.argv[1])[0].id #get id
#get live by id (if var not empty) #get live by id (if var not empty)