mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-17 23:05:03 -05:00
* revert back to using the TCP transport to avoid http auth issues
This commit is contained in:
parent
07f6bb9ec3
commit
e73dcc9691
@ -215,8 +215,8 @@ if (getRenameLog().isEmpty()) {
|
|||||||
xbmc?.each{ host ->
|
xbmc?.each{ host ->
|
||||||
println "Notify XBMC: $host"
|
println "Notify XBMC: $host"
|
||||||
_guarded{
|
_guarded{
|
||||||
XBMC(host, 8080).showNotification('FileBot', "Finished processing ${tryQuietly { ut_title } ?: input*.dir.name.unique()} (${getRenameLog().size()} files).", 'http://filebot.sourceforge.net/images/icon.png')
|
showNotification(host, 9090, 'FileBot', "Finished processing ${tryQuietly { ut_title } ?: input*.dir.name.unique()} (${getRenameLog().size()} files).", 'http://filebot.sourceforge.net/images/icon.png')
|
||||||
XBMC(host, 8080).scanVideoLibrary()
|
scanVideoLibrary(host, 9090)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,21 +9,19 @@ import net.sourceforge.filebot.mediainfo.*
|
|||||||
/**
|
/**
|
||||||
* XBMC helper functions
|
* XBMC helper functions
|
||||||
*/
|
*/
|
||||||
def XBMC(host, port = 8080) {
|
def scanVideoLibrary(host, port) {
|
||||||
new XBMCJsonRpc(endpoint:new URL("http://${host}:${port}/jsonrpc"))
|
_guarded {
|
||||||
|
telnet(host, port) { writer, reader ->
|
||||||
|
writer.println("""{"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":1}""")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XBMCJsonRpc {
|
def showNotification(host, port, title, message, image) {
|
||||||
def endpoint
|
_guarded {
|
||||||
|
telnet(host, port) { writer, reader ->
|
||||||
def invoke(json) {
|
writer.println("""{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"${escapeJavaScript(title)}","message":"${escapeJavaScript(message)}", "image":"${escapeJavaScript(image)}"},"id":1}""")
|
||||||
endpoint.post(json.getBytes('UTF-8'), 'application/json').text
|
|
||||||
}
|
}
|
||||||
def scanVideoLibrary() {
|
|
||||||
invoke("""{"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":1}""")
|
|
||||||
}
|
|
||||||
def showNotification(title, message, image) {
|
|
||||||
invoke("""{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"${escapeJavaScript(title)}","message":"${escapeJavaScript(message)}", "image":"${escapeJavaScript(image)}"},"id":1}""")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user