mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 16:58:51 -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 ->
|
||||
println "Notify XBMC: $host"
|
||||
_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')
|
||||
XBMC(host, 8080).scanVideoLibrary()
|
||||
showNotification(host, 9090, 'FileBot', "Finished processing ${tryQuietly { ut_title } ?: input*.dir.name.unique()} (${getRenameLog().size()} files).", 'http://filebot.sourceforge.net/images/icon.png')
|
||||
scanVideoLibrary(host, 9090)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,21 +9,19 @@ import net.sourceforge.filebot.mediainfo.*
|
||||
/**
|
||||
* XBMC helper functions
|
||||
*/
|
||||
def XBMC(host, port = 8080) {
|
||||
new XBMCJsonRpc(endpoint:new URL("http://${host}:${port}/jsonrpc"))
|
||||
def scanVideoLibrary(host, port) {
|
||||
_guarded {
|
||||
telnet(host, port) { writer, reader ->
|
||||
writer.println("""{"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":1}""")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class XBMCJsonRpc {
|
||||
def endpoint
|
||||
|
||||
def invoke(json) {
|
||||
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}""")
|
||||
def showNotification(host, port, title, message, image) {
|
||||
_guarded {
|
||||
telnet(host, port) { writer, reader ->
|
||||
writer.println("""{"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