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

@@ -100,7 +100,6 @@ function shows {
export downloaddir=$(head -n 2 "$1" | tail -n 1)
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 '#' | xargs)
showName="$(echo $i | cut -f 2 -d '#' | xargs)"
modifier="$(echo $i | cut -f 3 -d '#' | xargs)"
@@ -108,6 +107,11 @@ function shows {
episode=$(echo $sepisode | cut -f 2 -d 'E')
newep=$(printf "%02d\n" $((${episode#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
# We found an episode.
echo $i | tee -a $logfile
@@ -121,7 +125,11 @@ function shows {
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 [ -z "$modifier" ]; then
getmagnetlink "$showName S${newseason}E01"
else
getmagnetlink "$showName S${newseason}E01 $modifier"
fi
if [ "$magnetlink" != "" ]; then
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"