#!/bin/bash
if [ "$7" -ne "0" ]; then
# not successfully downloaded
exit
fi
## Prowl
prowl_api="bla"
prowl_app="SABnzbd"
prowl_url="https://api.prowlapp.com/publicapi/add"
curl -s -o /dev/null -d "apikey=$prowl_api" -d "application=$prowl_app" -d "event=$3" -d "description=$3 downloaded [$5]" "$prowl_url"
if [ "$5" == "tv" ]; then
## Trakt
trakt_user="foo"
trakt_pass="sha1bar"
trakt_api="keyfoo"
trakt_url="http://api.trakt.tv/show/episode/library/$trakt_api"
# trakt_test
# trakt_test="http://api.trakt.tv/account/test/$trakt_api"
# curl -d "username=$trakt_user" -d "password=$trakt_pass" $trakt_test
title="$(echo "$3" | sed 's/ - [0-9]*x.*//')"
season="$(echo "$3" | sed 's/^.* - \([0-9]*\)x.*/\1/')"
episode="$(echo "$3" | sed 's/^.* - [0-9]*x\([0-9]*\) .*/\1/')"
echo '
{
"username": "'"$trakt_user"'",
"password": "'"$trakt_pass"'",
"title": "'"$title"'",
"episodes": [
{
"season": '"$season"',
"episode": '"$episode"'
}
]
}' | curl -s -o /dev/null --data-binary @- "$trakt_url"
fi
Add a code snippet to your website: www.paste.org