Skip to content

Instantly share code, notes, and snippets.

@toodooleedoo
Last active August 29, 2015 14:14
Show Gist options
  • Save toodooleedoo/c93f7c65d66f3f757769 to your computer and use it in GitHub Desktop.
Save toodooleedoo/c93f7c65d66f3f757769 to your computer and use it in GitHub Desktop.
#LINUX Sickbeard download to Pushover

Monitors my local Sickbeard for new downloads and sends an alert if found.

While I understand this funcitonality exists within Sickbeard this gave me a bit more flexibility that I wanted to send show descriptions, change alert level, send to differet devices, etc.

USER="<<<CUT>>>"
TOKEN="<<<CUT>>>"
touch history.log
curl --silent "http://192.168.1.4:8081/history/" |grep "Downloaded" -B1 |grep "<td>" |while read line; do
FULL=`echo "${line}" |sed -e 's/.*">//g;s/<\/a>.*//g;'`
grep "${FULL}" history.log >/dev/null
if [ $? = 1 ]; then
SHOW=`echo "${line}" |sed -e 's/.*show=//g;s/#.*//g;'`
printf "ADDING: ";
echo "${FULL}" |tee -a history.log
SEASON=`echo "${FULL}" |sed -e 's/.* - //g;' |awk -Fx '{print $1}'`
EPISODE=`echo "${FULL}" |sed -e 's/.* - //g;' |awk -Fx '{print $2}'`
DESCRIPTION=`curl --silent "http://192.168.1.4:8081/home/plotDetails?show=${SHOW}&episode=${EPISODE}&season=${SEASON}"`
curl --silent -k "https://api.pushover.net/1/messages.json" -d "token=${TOKEN}" -d "user=${USER}" -d "title=${FULL}" -d "message=${DESCRIPTION:0:50}" -d "url_title=Open NZB360" -d "url=tasker://Open NZB360" -d "priority=-2" -d "device=edroid"
curl --silent -k "https://api.pushover.net/1/messages.json" -d "token=${TOKEN}" -d "user=${USER}" -d "title=${FULL}" -d "message=${DESCRIPTION:0:50}" -d "url_title=Open NZB360" -d "url=tasker://Open NZB360" -d "priority=0" -d "device=adroid" -d "sound=incoming"
HTMLSAFE_FULL=`perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${FULL}"`
HTMLSAFE_DESCRIPTION=`perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${DESCRIPTION}"`
#curl "http://192.168.1.4:1818?message=sickbeardwatcher=:=${HTMLSAFE_FULL}-${HTMLSAFE_DESCRIPTION:0:100}"
curl "http://192.168.1.4:1818?message=sickbeardwatcher=:=${HTMLSAFE_FULL}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment