Page 1 of 1

XBMC notification

Posted: 22 Feb 2013, 18:04
by snoopy
Hi,

is it possible to call xbmc built-in functions from filebot script? I wan't to display onscreen message when filebot does it's thing.

http://wiki.xbmc.org/index.php?title=Li ... _functions

Re: XBMC notification

Posted: 23 Feb 2013, 03:40
by rednoah
Not a priority for me right now. You can probably figure out by looking at how I tell xbmc to rescan its library.

Re: XBMC notification

Posted: 26 Feb 2013, 11:34
by snoopy
Hi. Bottom code for rescanning library in XBMC frodo also doesn't work. Have just test it in TV shows and i had to do a manual rescan.

--def xbmc=hostname

xbmc?.each{
println "Notify XBMC: $it"
invokeScanVideoLibrary(it)

Re: XBMC notification

Posted: 26 Feb 2013, 14:30
by rednoah
Can you check if XMBC is recieving the command in the XMBC logs? And if the command is compatible with Frodo or possibly something outdated for a previous release.

Re: XBMC notification

Posted: 26 Feb 2013, 16:28
by rednoah
This is what it's currently doing:

Code: Select all

telnet(host, port) { writer, reader ->
	writer.println('{"id":1,"method":"VideoLibrary.Scan","params":[],"jsonrpc":"2.0"}') // API call for latest XBMC release
}
You can try this in a standalone script and try making various calls. Let me know what works.

EDIT: This works at least on Eden here. The BuiltinExec stuff you suggested is depricated and won't work with Frodo.

EDIT2: This works with Frodo:

Code: Select all

def xbmc = new URL('http://localhost:8080/jsonrpc')
println xbmc.post('{"id":1,"method":"VideoLibrary.Scan","params":[],"jsonrpc":"2.0"}'.getBytes('UTF-8'), 'application/json').text
println xbmc.post('{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"fooo","message":"bar", "image":"http://filebot.sourceforge.net/images/icon.png", "displaytime":10000},"id":1}' as byte[], 'application/json').text

Re: XBMC notification

Posted: 26 Feb 2013, 22:13
by snoopy
Hi,

great work. I see that you have already include it to the scripts. Tnx!

Re: XBMC notification

Posted: 28 Feb 2013, 12:31
by snoopy
Hi rednoah,

one more thing. How can i specify username and password for http in amc.groovy? I'm getting 401 error.

------------------------------------------
IOException: Server returned HTTP response code: 401 for URL: http://xxxxx:xxxx/jsonrpc
------------------------------------------

Re: XBMC notification

Posted: 28 Feb 2013, 15:50
by rednoah
Worked for me, but maybe the HTTP transport is mafan. I'll switch back to TCP like before:
http://wiki.xbmc.org/index.php?title=JSON-RPC_API#TCP

Already uploaded my changes.

Re: XBMC notification

Posted: 09 Mar 2013, 12:01
by iampaulh
is this integrated already!?

I was just watching a show and Filebot popped up saying a new show had been processed! It even updated the recently added episodes list! Awesome :D

Re: XBMC notification

Posted: 09 Mar 2013, 12:45
by rednoah
Sure. If you run a script from online (via URL or fn:name syntax) you'll always be running the latest and greatest. ;)