* Support Pushover notifications
This commit is contained in:
parent
b1de604df8
commit
afb0d24c3b
|
@ -19,3 +19,4 @@ themoviedb.apikey: 5a6edae568130bf10617b6d45be99f13
|
|||
serienjunkies.apikey: 9fbhw9uebfiwvbefzuwv
|
||||
fanart.tv.apikey: 780b986b22c35e6f7a134a2f392c2deb
|
||||
acoustid.apikey: 0B3qZnQc
|
||||
pushover.apikey: wcckDz3oygHSU2SdIptvnHxJ92SQKK
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue