EdgarAuto wrote:I have been trying to figure out an EASY way to get the Now Playing song info from XBMC either using the XBMC2 plugin or not.
I guess the Easy way is to ask here
The GetCurrentlyPlayingFilename does not work.
Jupp, it's been broken for a while, Have not decided what to do with it as I have been concentrating on finishing other stuff. I definitely want an easy way to get basic info from XBMC.
I currently can get it using a python TCP script with a JSON request but trying to parse everything out into a usable payload variable is painful.
Directly from XBMC, ush. That's why I added JSON-RPC support to make it easier. Unfortunately it has taken a bit longer for me to get it finished.
Is there an easy way to get this to come back in a payload?
Well that depends on your definition.
Code: Select all
PlayerID = eg.plugins.XBMC2.JSONRPC(u'Player.GetActivePlayers', u'', False)['playerid']
eg.result = eg.plugins.XBMC2.JSONRPC(u'Player.GetItem', u"["+str(PlayerID)+",['title','file']]", False)
Put this in a Python script, and when you have a song playing you should get a "title","file" and some other properties in the eg.result variable.
To get for example the "Title" use eg.result['item']['title']
To get other properties add/change the "['title','file']" part of the code, a list of fields are here
(click the show
Just post again if it don't work or you want more info. If your using the recently posted "test" version you need to update to "update3
" as it had a bug with JSON-RPC.