Adding date/time show tracking under new function, error tracking for critical functions

This commit is contained in:
example 2016-11-16 18:11:48 -06:00
parent 02ab50f585
commit 05b4439b61
6 changed files with 46 additions and 19 deletions

View File

@ -1,6 +1,6 @@
torrentengine=https://1337x.to/search/%s/1/
torrentterms=printf https://1337x.to; grep "/torrent/" | head -n 1 | cut -f 10 -d \"
magnetposition=4
torrentdebugging=true
torrentdebugging=false
searchunifier=+
magnetseparator="

View File

@ -15,3 +15,5 @@ fi
header Getting magnet link.
getmagnetlink "$(echo $1 | tr '#' "$searchunifier")"
echo
echo Found: $magnetlink

View File

@ -0,0 +1,6 @@
torrentengine=https://www.torrentdownloads.me/search/?search=%s
torrentterms=printf https://www.torrentdownloads.me/; grep "/torrent/" | head -n 1 | cut -f 78 -d \"
magnetposition=4
torrentdebugging=false
searchunifier=+
magnetseparator="

View File

@ -1,6 +1,6 @@
torrentengine=http://torrentproject.se/?t=%s
torrentterms=printf http://torrentproject.se; grep "verified" | head -n 1 | cut -f 2 -d \' | head -n 1
magnetposition=2
torrentdebugging=true
torrentdebugging=false
searchunifier=+
magnetseparator='

View File

@ -1,6 +1,6 @@
torrentengine=https://thepiratebay.org/search/%s/0/99/0/
torrentterms=printf https://thepiratebay.org; grep "/torrent/" | head -n 1 | cut -f 4 -d \"
magnetposition=4
torrentdebugging=true
torrentdebugging=false
searchunifier=%20
magnetseparator="

View File

@ -1,7 +1,10 @@
#!/bin/bash
source /usr/local/src/SharedLibraries/Bash/header
configuretorrent /usr/local/etc/WolfPack/torrentengine
if [ -z "$3" ]; then
configuretorrent /usr/local/etc/WolfPack/torrentengine
else
configuretorrent "$3"
fi
export IFS="
"
export logfile='/var/log/wolfpack.log'
@ -15,12 +18,11 @@ function helptext {
// /~_____/ with their prey.
/// \\/ / ~dev@aninix.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wolfpack --alpha ~~ Tell the alpha to send the
wolfpack --alpha [enginefile] ~~ Tell the alpha to send the
pack members hunting.
wolfpack --member <pup> ~~ Send a member to train a pup
wolfpack --member <pup> [enginefile] ~~ Send a member to train a pup
and bring back results.
wolfpack --stop-torrent ~~ Stop any transmission-cli
processes
wolfpack --help ~~ Show this helptext
Available pup types (all pups are line-delimited with the type and
result location as the first two lines):
@ -45,11 +47,20 @@ function helptext {
function privacycheck {
if [ "$(whatismyip)" == "$(nslookup aninix.net | grep Address | cut -f 2 -d ' ' | tail -n 1)" ]; then
echo "Should not torrent directly from the AniNIX main IP for privacy reasons" 2>&1 | tee -a $logfile
echo "ERROR: Should not torrent directly from the AniNIX main IP for privacy reasons" 2>&1 | tee -a $logfile
exit 1
fi
}
function nextairdate {
if [ -z "$1" ]; then
echo "Need a show to search for"
exit 1;
fi
wget -q -O - https://www.episodate.com/tv-show/"$(echo $1 | sed 's/[ \t]*$//' | sed 's/^[ \t]*//' | tr ' ' '-' | tr '[:upper:]' '[:lower:]')"?season=99 | tr '>' '\n' | grep episode_datetime_convert | head -n 1 | cut -f 4 -d \" | cut -f 1 -d 'T'
return
}
function transmissioncheck {
if [ "$(pgrep -afc transmission-cli)" -ne 0 ]; then
echo "Transmission is still running. Aborting." | tee -a $logfile
@ -90,12 +101,13 @@ function shows {
echo "Would download to "$downloaddir
for i in $(tail -n +3 "$1"); do
getmagnetlink "$(echo $i | tr '#' "$searchunifier")"
export sepisode=$(echo $i | cut -f 1 -d '#')
export searchterms="$(echo $i | cut -f 2 -d '#')"
export season=$(echo $sepisode | cut -f 1 -d 'E' | cut -f 2 -d 'S')
export episode=$(echo $sepisode | cut -f 2 -d 'E')
export newep=$(printf "%02d\n" $((${episode#0} + 1)))
export newseason="$(printf "%02d\n" $((${season#0} + 1)))"
sepisode=$(echo $i | cut -f 1 -d '#')
showName="$(echo $i | cut -f 2 -d '#')"
searchterms="$showName"' '"$(echo $i | cut -f 2 -d '#')"
season=$(echo $sepisode | cut -f 1 -d 'E' | cut -f 2 -d 'S')
episode=$(echo $sepisode | cut -f 2 -d 'E')
newep=$(printf "%02d\n" $((${episode#0} + 1)))
newseason="$(printf "%02d\n" $((${season#0} + 1)))"
if [ "$magnetlink" != "" ]; then
# We found an episode.
echo $i | tee -a $logfile
@ -115,7 +127,15 @@ function shows {
/usr/bin/transmission-cli -d 600 -u 1 -er -w "$downloaddir" -b -f "/usr/local/bin/wolfpack-stoptorrent" "$magnetlink"
sed -i "s/$i/S"$newseason"E01#"$searchterms"/" "$1"
else
echo "No new season found for $searchterms" | tee -a $logfile
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
echo ERROR: Should have found a new episode for $searchterms and did not -- check your provider\! | tee -a $logfile
fi
else
echo "No new season found for $showName" | tee -a $logfile
fi
fi
fi
done
@ -164,7 +184,6 @@ function search {
done
}
if [ "$1" == "" ]; then
helptext;
exit 1;
@ -182,7 +201,7 @@ case "$1" in
fi
echo "Starting members from pup in "$basedir | tee -a $logfile
for i in $(find "$basedir" -type f | grep '.pup'); do
/usr/local/bin/wolfpack --member "$i";
/usr/local/bin/wolfpack --member "$i" "$3";
done
;;