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