Fixes for next air date of episodes, update parsing

This commit is contained in:
DarkFeather 2017-01-11 19:07:05 -06:00
parent 05b4439b61
commit 726ece669b
2 changed files with 10 additions and 10 deletions

View File

@ -4,7 +4,7 @@ compile: ./tpb.torrentengine.sample
if [ ! -d /usr/local/etc/WolfPack ]; then mkdir -p /usr/local/etc/WolfPack; chmod 0770 /usr/local/etc/WolfPack; cp ./*.pup /usr/local/etc/WolfPack; cp ./tpb.torrentengine.sample /usr/local/etc/WolfPack; chmod 0660 /usr/local/etc/WolfPack/*; echo "Default configuration directory of /usr/local/etc/WolfPack created with example pups and torrent engine."; fi
@echo "Run make install and add '/usr/local/bin/wolfpack --alpha' to root's crontab to schedule data collection."
install: /usr/bin/wget /usr/bin/transmission-cli /usr/bin/googler wolfpack wolfpack-stoptorrent /usr/local/bin/whatismyip
install: /usr/bin/wget /usr/bin/transmission-cli /usr/bin/googler wolfpack wolfpack-stoptorrent /usr/local/bin/whatismyip /usr/bin/lynx
cp -p /usr/local/src/WolfPack/wolfpack /usr/local/bin/wolfpack
cp -p /usr/local/src/WolfPack/wolfpack-stoptorrent /usr/local/bin/wolfpack-stoptorrent
make checkperm

View File

@ -57,7 +57,7 @@ function nextairdate {
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'
lynx --dump "https://www.episodate.com/tv-show/$(echo $1 | tr '[:upper:]' '[:lower:]' | tr ' ' '-')?season=99" | grep 'and airs on' | sed 's# Season [0-9] / Episode [0-9][0-9] and airs on ##'
return
}
@ -101,9 +101,9 @@ function shows {
echo "Would download to "$downloaddir
for i in $(tail -n +3 "$1"); do
getmagnetlink "$(echo $i | tr '#' "$searchunifier")"
sepisode=$(echo $i | cut -f 1 -d '#')
showName="$(echo $i | cut -f 2 -d '#')"
searchterms="$showName"' '"$(echo $i | cut -f 2 -d '#')"
sepisode=$(echo $i | cut -f 1 -d '#' | xargs)
showName="$(echo $i | cut -f 2 -d '#' | xargs)"
modifier="$(echo $i | cut -f 3 -d '#' | xargs)"
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)))
@ -111,21 +111,21 @@ function shows {
if [ "$magnetlink" != "" ]; then
# We found an episode.
echo $i | tee -a $logfile
/usr/bin/transmission-cli -d 600 -u 1 -er -w "$downloaddir" -b -f "/usr/local/bin/wolfpack-stoptorrent" "$magnetlink"
sed -i "s/$i/S"$season"E"$newep"#"$searchterms"/" "$1"
# /usr/bin/transmission-cli -d 600 -u 1 -er -w "$downloaddir" -b -f "/usR/Local/bin/wolfpack-stoptorrent" "$magnetlink"
sed -i "s/$i/S${season}E${newep}#${showName}#${modifier}/" "$1"
echo Downloaded and pup updated. | tee -a $logfile
rm -Rf ~/.config/transmission/resume/*
rm -Rf ~/.config/transmission/torrents/*
rm -f "$downloaddir"/*/*.txt # Including this to avoid breaking Plex
rm -f "$downloaddir"/*/*.txt # Including this to avoid breaking Yggdrasil
rm -f "$downloaddir"/*/*.nfo
echo | tee -a $logfile
else
# We didn't -- is there a new season?
getmagnetlink "$(echo $i | sed 's/S'$season'E'$episode'/S'$newseason'E01/' | tr '#' "$searchunifier")"
if [ "$magnetlink" != "" ]; then
echo "S"$newseason"E01" $searchterms | 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"
sed -i "s/$i/S"$newseason"E01#"$searchterms"/" "$1"
sed -i "s/$i/S${newseason}E01#$showName#$modifier/" "$1"
else
nextAirDate="$(nextairdate "$showName")"
if [ ! -z "$nextAirDate" ]; then