* Support Pushover notifications

This commit is contained in:
Reinhard Pointner 2013-01-22 08:14:21 +00:00
parent b1de604df8
commit afb0d24c3b
3 changed files with 40 additions and 0 deletions

View File

@ -19,3 +19,4 @@ themoviedb.apikey: 5a6edae568130bf10617b6d45be99f13
serienjunkies.apikey: 9fbhw9uebfiwvbefzuwv serienjunkies.apikey: 9fbhw9uebfiwvbefzuwv
fanart.tv.apikey: 780b986b22c35e6f7a134a2f392c2deb fanart.tv.apikey: 780b986b22c35e6f7a134a2f392c2deb
acoustid.apikey: 0B3qZnQc acoustid.apikey: 0B3qZnQc
pushover.apikey: wcckDz3oygHSU2SdIptvnHxJ92SQKK

View File

@ -1,3 +1,33 @@
/****************************************************************************
* Pushover
* https://pushover.net
****************************************************************************/
def Pushover(user, token = 'wcckDz3oygHSU2SdIptvnHxJ92SQKK') {
new PushoverClient(user:user, token:token)
}
class PushoverClient {
def user
def token
def endpoint = new URL('https://api.pushover.net/1/messages.xml')
def send = { text, parameters = [:] ->
// inject default post parameters
parameters << [token:token, user:user, message:text as String]
// post and process response
endpoint.post(parameters).text.xml
}
}
/****************************************************************************
* MyEpisodes
* http://www.myepisodes.com
****************************************************************************/
@Grab(group='org.jsoup', module='jsoup', version='1.7.1') @Grab(group='org.jsoup', module='jsoup', version='1.7.1')
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.Connection.Method import org.jsoup.Connection.Method

View File

@ -24,6 +24,7 @@ def plex = tryQuietly{ plex.split(/[ ,|]+/) }
// myepisodes updates and email notifications // myepisodes updates and email notifications
def myepisodes = tryQuietly { myepisodes.split(':', 2) } def myepisodes = tryQuietly { myepisodes.split(':', 2) }
def gmail = tryQuietly{ gmail.split(':', 2) } def gmail = tryQuietly{ gmail.split(':', 2) }
def pushover = tryQuietly{ pushover }
// series/anime/movie format expressions // series/anime/movie format expressions
@ -222,6 +223,14 @@ if (myepisodes) {
include('fn:update-mes', [login:myepisodes.join(':'), addshows:false], getRenameLog().values()) include('fn:update-mes', [login:myepisodes.join(':'), addshows:false], getRenameLog().values())
} }
if (pushover) {
// include webservice utility
include('fn:lib/ws')
println('Sending Pushover notification')
Pushover(pushover).send("Finished processing ${tryQuietly { ut_title } ?: input*.dir.name.unique()} (${getRenameLog().size()} files).")
}
// send status email // send status email
if (gmail) { if (gmail) {
// ant/mail utility // ant/mail utility