Fixes
This commit is contained in:
33
wolfpack
33
wolfpack
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
source /usr/local/src/SharedLibraries/Bash/header
|
||||
export downloadtorrent="sudo -u deluge deluge-console add"
|
||||
export downloadtorrent="sudo -u deluge deluge-console 2>/dev/null add"
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
configuretorrent /usr/local/etc/WolfPack/torrentengine
|
||||
@@ -28,6 +28,8 @@ wolfpack --member <pup> [enginefile] ~~ Send a member to train a
|
||||
torrent engine file.
|
||||
wolfpack --torrent-monitor ~~ Pull up the Deluge console
|
||||
for torrents.
|
||||
wolfpack --torrent-lookup ~~ Look up and add a torrent
|
||||
if user confirms.
|
||||
wolfpack --reset-log ~~ Clear the wolfpack log. This
|
||||
is in /var/log/wolfpack.log.
|
||||
wolfpack --help ~~ Show this helptext
|
||||
@@ -53,7 +55,8 @@ search ~~ Uses the Google search
|
||||
}
|
||||
|
||||
function privacycheck {
|
||||
if [ "$(/usr/local/bin/whatismyip)" == "$(nslookup aninix.net | grep Address | cut -f 2 -d ' ' | tail -n 1)" ]; then
|
||||
ip="$(/usr/local/bin/whatismyip)"
|
||||
if [ -z "$ip" ] || [ "$ip" == "$(nslookup aninix.net | grep Address | cut -f 2 -d ' ' | tail -n 1)" ]; then
|
||||
echo "ERROR: Should not torrent directly from the AniNIX main IP for privacy reasons" 2>&1 | tee -a "$logfile"
|
||||
exit 1
|
||||
fi
|
||||
@@ -75,6 +78,7 @@ 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
|
||||
for i in $(tail -n +3 "$1"); do
|
||||
getmagnetlink "$i"
|
||||
if [ "$magnetlink" != "" ]; then
|
||||
@@ -94,7 +98,7 @@ function shows {
|
||||
fi
|
||||
privacycheck;
|
||||
export downloaddir=$(head -n 2 "$1" | tail -n 1)
|
||||
echo "Would download to "$downloaddir
|
||||
sudo -u deluge deluge-console config -s torrentfiles_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)"
|
||||
@@ -132,7 +136,7 @@ function shows {
|
||||
nextAirDate="$(nextairdate "$showName")"
|
||||
if [ ! -z "$nextAirDate" ]; then
|
||||
echo "No new season found for $showName -- next airs $(nextairdate "$showName")" | tee -a "$logfile"
|
||||
if [ "$(date -s "$nextAirDate" -u +%s)" -lt "$(date -u +%s)" ]; then
|
||||
if [ "$(date -d "$nextAirDate" -u +%s)" -lt "$(date -u +%s)" ]; then
|
||||
echo ERROR: Should have found a new episode for $searchterms and did not -- check your provider\! | tee -a "$logfile"
|
||||
fi
|
||||
else
|
||||
@@ -233,9 +237,28 @@ case "$1" in
|
||||
exit 0;
|
||||
;;
|
||||
"--torrent-monitor")
|
||||
exec sudo -u deluge deluge-console;
|
||||
exec sudo -u deluge deluge-console 2>/dev/null;
|
||||
exit 0;
|
||||
;;
|
||||
"--torrent-lookup")
|
||||
configuretorrent /usr/local/etc/WolfPack/torrentengine
|
||||
getmagnetlink "$(echo $2 | tr '#' "$searchunifier")"
|
||||
if [ -z "$magnetlink" ]; then
|
||||
echo Nothing found;
|
||||
exit 0;
|
||||
fi
|
||||
echo
|
||||
echo Found: $magnetlink
|
||||
echo
|
||||
|
||||
echo 'Acceptable? [y/n]'
|
||||
read answer
|
||||
if [ "$answer" == "y" ]; then
|
||||
/bin/bash -c "$downloadtorrent $magnetlink"
|
||||
fi;
|
||||
exit 0;
|
||||
;;
|
||||
|
||||
*)
|
||||
helptext
|
||||
;;
|
||||
|
Reference in New Issue
Block a user