Fixes for searcher default upload terming and whitespace handling

This commit is contained in:
DarkFeather 2017-01-18 20:27:33 -06:00
parent ad5208ab6b
commit 360f91458a
3 changed files with 25 additions and 9 deletions

View File

@ -1,18 +1,27 @@
#!/bin/bash #!/bin/bash
logfile=/var/log/wolfpack.log
target='cxford@10.0.1.3'
echo Starting VPN and delaying 40 seconds....
systemctl start vpn
sleep 40
echo | systemctl status | tee -a $logfile
if [ "$(pgrep -afc wolfpack)" -ne 1 ]; then if [ "$(pgrep -afc wolfpack)" -ne 1 ]; then
echo WolfPack is already working elsewhere. echo WolfPack is already working elsewhere.
exit 1 exit 1
fi fi
/usr/local/bin/wolfpack --alpha /usr/local/bin/wolfpack --alpha
sleep 10 sleep 10
rsync -avz /srv/yggdrasil/new_acquisition/* cxford@10.0.1.3:/srv/yggdrasil/new_acquisition 2>&1 | tee -a /var/log/wolfpack.log 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 /var/log/wolfpack.log ls -l /srv/yggdrasil/new_acquisition | tee -a $logfile
echo Files transferred from $(uname -n). | tee -a /var/log/wolfpack.log echo Files transferred from $(uname -n). | tee -a $logfile
rm -Rf /srv/yggdrasil/new_acquisition/* rm -Rf /srv/yggdrasil/new_acquisition/*
cat /var/log/wolfpack.log | ssh cxford@aninix.net "cat >> /var/log/wolfpack.log" cat $logfile | ssh cxford@aninix.net "cat >> $logfile"
rm /var/log/wolfpack.log rm $logfile
for i in $(ls /usr/local/etc/WolfPack/*.pup); do for i in $(ls /usr/local/etc/WolfPack/*.pup); do
export cmdstring="$(echo $i | sed "s/pup/$(uname -n)/")" export cmdstring="$(echo $i | sed "s/pup/$(uname -n)/")"
scp "$i" cxford@aninix.net:"$cmdstring" scp "$i" "$target":"$cmdstring"
done done
systemctl stop vpn

View File

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "Need search terms" echo "Need search terms"
exit 1; exit 1;

View File

@ -100,7 +100,6 @@ function shows {
export downloaddir=$(head -n 2 "$1" | tail -n 1) export downloaddir=$(head -n 2 "$1" | tail -n 1)
echo "Would download to "$downloaddir echo "Would download to "$downloaddir
for i in $(tail -n +3 "$1"); do for i in $(tail -n +3 "$1"); do
getmagnetlink "$(echo $i | tr '#' "$searchunifier")"
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)"
modifier="$(echo $i | cut -f 3 -d '#' | xargs)" modifier="$(echo $i | cut -f 3 -d '#' | xargs)"
@ -108,6 +107,11 @@ function shows {
episode=$(echo $sepisode | cut -f 2 -d 'E') episode=$(echo $sepisode | cut -f 2 -d 'E')
newep=$(printf "%02d\n" $((${episode#0} + 1))) newep=$(printf "%02d\n" $((${episode#0} + 1)))
newseason="$(printf "%02d\n" $((${season#0} + 1)))" newseason="$(printf "%02d\n" $((${season#0} + 1)))"
if [ -z "$modifier" ]; then
getmagnetlink "$showName $sepisode"
else
getmagnetlink "$showName $sepisode $modifier"
fi
if [ "$magnetlink" != "" ]; then if [ "$magnetlink" != "" ]; then
# We found an episode. # We found an episode.
echo $i | tee -a $logfile echo $i | tee -a $logfile
@ -121,7 +125,11 @@ function shows {
echo | tee -a $logfile echo | tee -a $logfile
else else
# We didn't -- is there a new season? # We didn't -- is there a new season?
getmagnetlink "$(echo $i | sed 's/S'$season'E'$episode'/S'$newseason'E01/' | tr '#' "$searchunifier")" if [ -z "$modifier" ]; then
getmagnetlink "$showName S${newseason}E01"
else
getmagnetlink "$showName S${newseason}E01 $modifier"
fi
if [ "$magnetlink" != "" ]; then if [ "$magnetlink" != "" ]; then
echo "S${newseason}E01" $showName | tee -a $logfile echo "S${newseason}E01" $showName | tee -a $logfile
/usr/bin/transmission-cli -d 600 -u 1 -er -w "$downloaddir" -b -f "/usr/local/bin/wolfpack-stoptorrent" "$magnetlink" /usr/bin/transmission-cli -d 600 -u 1 -er -w "$downloaddir" -b -f "/usr/local/bin/wolfpack-stoptorrent" "$magnetlink"