Kodi Community Forum
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174)
+---- Thread: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC (/showthread.php?tid=68263)



- sooth - 2011-05-11

Montellese Wrote:This looks fine as long as "search" is an integer variable of a valid songid.
Yes of course, I've verified it is.


Montellese Wrote:Please try it with 0 for "item". IIRC the playlist entries start from 0 (as any index-based lists in most programming languages).
First thing I tried. Huh

It just sits here and does nothing..


- Montellese - 2011-05-11

Did you open the Playlist in XBMC GUI and checked if your call to Add actually worked and if you can start playing that item from XBMC GUI? If that works the problem is somewhere in Play() otherwise it is a problem in Add(). Thanks for reporting back.


- sooth - 2011-05-11

Nope, nothing visible in the GUI, not that I thought there would be though..

I'm looking to just queue up a bunch of songs and start playing them.. how can I do this? Huh


- Montellese - 2011-05-11

Where did you get the songid from you pass to the Playlist's Add() method? Best way is to get an artistid, albumid or songid from AudioLibrary.GetArtists, AudioLibrary.GetAlbums or AudioLibrary.GetSongs and then use the retrieved id in the Add() method. You can also pass an absolute path to a song using the "file" parameter or an absolute path to a directory containing (multiple) songs using the "directory" parameter.


- sooth - 2011-05-12

Montellese Wrote:Where did you get the songid from you pass to the Playlist's Add() method? Best way is to get an artistid, albumid or songid from AudioLibrary.GetArtists, AudioLibrary.GetAlbums or AudioLibrary.GetSongs and then use the retrieved id in the Add() method. You can also pass an absolute path to a song using the "file" parameter or an absolute path to a directory containing (multiple) songs using the "directory" parameter.

Yes that's what I am doing, however, when I pass the songid with the Add() method, nothing happens. It says the command completed, but nothing happens.

If I call Play(), nothing happens..


- topfs2 - 2011-05-12

Please post a full Debug Log when you do the queries so we can see what is actually sent to xbmc.


- sooth - 2011-05-12

http://pastebin.com/V0K8H0J9


- topfs2 - 2011-05-12

darnit, keep forgetting that we don't log all queries Smile


- sooth - 2011-05-12

topfs2 Wrote:darnit, keep forgetting that we don't log all queries Smile

Thanks for your help so far, you're really patient with everyone on this board.

Can you provide me with any guidance? I'm totally confused here, I've followed what I believe is the correct way, I've even tested with the REST thingy in Chrome, and I get that my command was "OK" but nothing happens.

I'm just trying to queue up some songs; trying to write a simple extension to my home automation software.

EDIT: Here are the commands that I am running:

Code:
{"id":1,"jsonrpc":"2.0","method":"AudioLibrary.GetSongs", "params":{"artistid":31}}
{"id":1,"jsonrpc":"2.0","method":"AudioPlaylist.Clear"}
{"jsonrpc":"2.0","method":"AudioPlaylist.Add","params":{"item":{"songid":2097}},"id":1}
{"jsonrpc":"2.0","method":"AudioPlaylist.Add","params":{"item":{"songid":20971}},"id":1}
{"jsonrpc":"2.0","method":"AudioPlaylist.Play", "params": {"item":0}, "id":2}



- sooth - 2011-05-12

Err does AudioLibrary.GetGenres no longer exist?


- Montellese - 2011-05-12

It does in the git repository and it shouldn't have been removed. I can't test it because I'm still at university but the code suggests that it is still available.

What version of XBMC are you using?


- ppic - 2011-05-13

i've explored json.introspect http://pastebin.com/2P99BmGH

but i can't find a way to get info on what's currently playing.

does someone have a hint ?


- Montellese - 2011-05-13

There's not a single method which returns the currently playing item because we want to provide as much specific information as possible about every item returned.

What you need to do is call Player.GetActivePlayer which returns whether the audio, video or picture player is active. Based on that information you need to call AudioPlayer.GetItems or VideoPlayer.GetItems (pictures is not supported yet). Apart from the list of items in the playlist it will also return a value labeled "current" which returns the index of the currently playing item.


- topfs2 - 2011-05-13

You get active player and query its playlist


- ppic - 2011-05-13

ho yes i see ! thanks !