Fixes for wolfpack to use right torrentfile location

This commit is contained in:
example 2017-10-20 07:42:08 -05:00
parent 572fc6987a
commit ff7aa509fa
2 changed files with 41 additions and 27 deletions

View File

@ -1,30 +1,42 @@
#!/bin/bash #!/bin/bash
logfile=/var/log/wolfpack.log logfile=/var/log/wolfpack.log
lockdir="/tmp/offload-wolfpack-lock" target="$1"
target='cxford@10.0.1.3' dir=`sudo -u deluge deluge-console config download_location 2>/dev/null | head -n 1 | sed 's/ download_location: //'`
mkdir "$lockdir" if [ -z "$target" ]; then
if [ $? -ne 0 ]; then echo Usage: $0 '[target]';
echo "Wolfpack running elsewhere"
exit 1 exit 1
fi fi
echo Starting VPN and delaying 40 seconds....
systemctl start vpn sudo -u deluge deluge-console info 2>/dev/null | (
sleep 40 unset name;
echo | systemctl status vpn | tee -a $logfile unset id;
/usr/local/bin/wolfpack --alpha unset state;
sleep 10 while read line; do
rsync -avz /srv/yggdrasil/new_acquisition/* cxford@10.0.1.3:/srv/yggdrasil/new_acquisition 2>&1 | tee -a $logfile case "$line" in
ls -l /srv/yggdrasil/new_acquisition | tee -a $logfile "Name:"*) name="$(echo $line | sed 's/Name: //')"; ;;
echo Files transferred from $(uname -n). | tee -a $logfile "State:"*) state="$(echo $line | cut -f 2 -d ' ')"; ;;
rm -Rf /srv/yggdrasil/new_acquisition/* "ID:"*) id="$(echo $line | sed 's/ID: //')"; ;;
cat $logfile | ssh cxford@aninix.net "cat >> $logfile" *)
rm $logfile if [ ! -z "$name" ] && [ ! -z "$id" ] && [ ! -z "$state" ]; then
for i in $(ls /usr/local/etc/WolfPack/*.pup); do echo Found "$name" "($id)" with state "$state"
export cmdstring="$(echo $i | sed "s/pup/$(uname -n)/")" if [ -e "$dir"'/'"$name" ]; then
scp "$i" "$target":"$cmdstring" echo "$name" exists on disk.
done fi
systemctl stop vpn if [ "$state" == "Seeding" ]; then
systemctl restart openntpd sudo -u deluge deluge-console 2>/dev/null rm "$id";
rmdir "$lockdir" rsync -avz "$dir"'/'"$name" $target:/srv/yggdrasil/new_acquisition
ret="$?"
if [ "$ret" -eq 0 ]; then
rm -Rf "$dir"'/'"$name"
else
echo "ERROR: Return was $ret" >> "$dir"/"$name"/error.log
fi
fi;
unset name; unset id; unset state;
fi ;;
esac
done)
cat /var/log/wolfpack.log | ssh $target /bin/bash -c 'cat >> /var/log/wolfpack.log'
cat /dev/null > /var/log/wolfpack.log

View File

@ -78,7 +78,8 @@ function torrent {
fi fi
privacycheck; privacycheck;
export downloaddir=$(head -n 2 "$1" | tail -n 1) export downloaddir=$(head -n 2 "$1" | tail -n 1)
sudo -u deluge deluge-console config -s torrentfiles_location "$downloaddir" 2>/dev/null sudo -u deluge deluge-console config -s autoadd_location "$downloaddir" 2>/dev/null
sudo -u deluge deluge-console config -s download_location "$downloaddir" 2>/dev/null
for i in $(tail -n +3 "$1"); do for i in $(tail -n +3 "$1"); do
getmagnetlink "$i" getmagnetlink "$i"
if [ "$magnetlink" != "" ]; then if [ "$magnetlink" != "" ]; then
@ -98,7 +99,8 @@ function shows {
fi fi
privacycheck; privacycheck;
export downloaddir=$(head -n 2 "$1" | tail -n 1) export downloaddir=$(head -n 2 "$1" | tail -n 1)
sudo -u deluge deluge-console config -s torrentfiles_location "$downloaddir" 2>/dev/null sudo -u deluge deluge-console config -s autoadd_location "$downloaddir" 2>/dev/null
sudo -u deluge deluge-console config -s download_location "$downloaddir" 2>/dev/null
for i in $(tail -n +3 "$1"); do for i in $(tail -n +3 "$1"); do
sepisode=$(echo $i | cut -f 1 -d '#' | xargs) sepisode=$(echo $i | cut -f 1 -d '#' | xargs)
showName="$(echo $i | cut -f 2 -d '#' | xargs)" showName="$(echo $i | cut -f 2 -d '#' | xargs)"
@ -131,7 +133,7 @@ function shows {
echo "S${newseason}E01" $showName | tee -a "$logfile" echo "S${newseason}E01" $showName | tee -a "$logfile"
echo "$magnetlink" | tee -a "$logfile" echo "$magnetlink" | tee -a "$logfile"
/bin/bash -c "$downloadtorrent $magnetlink" /bin/bash -c "$downloadtorrent $magnetlink"
sed -i "s/$i/S${newseason}E01#$showName#$modifier/" "$1" sed -i "s/$i/S${newseason}E02#$showName#$modifier/" "$1"
else else
nextAirDate="$(nextairdate "$showName")" nextAirDate="$(nextairdate "$showName")"
if [ ! -z "$nextAirDate" ]; then if [ ! -z "$nextAirDate" ]; then