Fixes for next air date of episodes, update parsing
This commit is contained in:
18
wolfpack
18
wolfpack
@@ -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
|
||||
|
Reference in New Issue
Block a user