From afb0d24c3b44317aac938108d27dc215861aa4bc Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 22 Jan 2013 08:14:21 +0000 Subject: [PATCH] * Support Pushover notifications --- .../sourceforge/filebot/Settings.properties | 1 + website/scripts/lib/ws.groovy | 30 +++++++++++++++++++ website/scripts/utorrent-postprocess.groovy | 9 ++++++ 3 files changed, 40 insertions(+) diff --git a/source/net/sourceforge/filebot/Settings.properties b/source/net/sourceforge/filebot/Settings.properties index cad70554..bddc7a2f 100644 --- a/source/net/sourceforge/filebot/Settings.properties +++ b/source/net/sourceforge/filebot/Settings.properties @@ -19,3 +19,4 @@ themoviedb.apikey: 5a6edae568130bf10617b6d45be99f13 serienjunkies.apikey: 9fbhw9uebfiwvbefzuwv fanart.tv.apikey: 780b986b22c35e6f7a134a2f392c2deb acoustid.apikey: 0B3qZnQc +pushover.apikey: wcckDz3oygHSU2SdIptvnHxJ92SQKK diff --git a/website/scripts/lib/ws.groovy b/website/scripts/lib/ws.groovy index 94a86e49..45e3c977 100644 --- a/website/scripts/lib/ws.groovy +++ b/website/scripts/lib/ws.groovy @@ -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') import org.jsoup.Jsoup import org.jsoup.Connection.Method diff --git a/website/scripts/utorrent-postprocess.groovy b/website/scripts/utorrent-postprocess.groovy index 4aeed53b..a9253bdb 100644 --- a/website/scripts/utorrent-postprocess.groovy +++ b/website/scripts/utorrent-postprocess.groovy @@ -24,6 +24,7 @@ def plex = tryQuietly{ plex.split(/[ ,|]+/) } // myepisodes updates and email notifications def myepisodes = tryQuietly { myepisodes.split(':', 2) } def gmail = tryQuietly{ gmail.split(':', 2) } +def pushover = tryQuietly{ pushover } // series/anime/movie format expressions @@ -222,6 +223,14 @@ if (myepisodes) { 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 if (gmail) { // ant/mail utility