XBMC notification

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
snoopy
Posts: 4
Joined: 22 Feb 2013, 17:57

XBMC notification

Post 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
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: XBMC notification

Post 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.
:idea: Please read the FAQ and How to Request Help.
snoopy
Posts: 4
Joined: 22 Feb 2013, 17:57

Re: XBMC notification

Post 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)
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: XBMC notification

Post 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.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: XBMC notification

Post 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
:idea: Please read the FAQ and How to Request Help.
snoopy
Posts: 4
Joined: 22 Feb 2013, 17:57

Re: XBMC notification

Post by snoopy »

Hi,

great work. I see that you have already include it to the scripts. Tnx!
snoopy
Posts: 4
Joined: 22 Feb 2013, 17:57

Re: XBMC notification

Post 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
------------------------------------------
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: XBMC notification

Post 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.
:idea: Please read the FAQ and How to Request Help.
iampaulh
Power User
Posts: 22
Joined: 24 Jan 2013, 12:12

Re: XBMC notification

Post 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
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: XBMC notification

Post 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. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply