* revert back to using the TCP transport to avoid http auth issues

This commit is contained in:
Reinhard Pointner 2013-02-28 15:48:51 +00:00
parent 07f6bb9ec3
commit e73dcc9691
2 changed files with 13 additions and 15 deletions

View File

@ -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)
}
}

View File

@ -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}""")
}
}
}