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)



- topfs2 - 2010-09-12

The idea is that you should be able to use sort and such aswell on add but looking at the code that test case have been overlooked and I guess it will need to wait until eden. But still, the add of an albumid should make it track wise afaik.

But otherwise your on your own for that and need to do get items and manually add each songid. A sturdier way is to add it to a virtual playlist and then start or add that virtual playlist to the currently playing one.

I'll see if I can cook up a patch for it unless someone beats me to it.

Something that should work is AudioPlaylist.Add", { "artistid": x, "sort": "track", "start": 3, "end": 15 }


- ncarthy - 2010-09-12

Thanks for taking a look at it. Is this the kind of thing that should be put on Trac?

I'm pretty sure no sorting is applied so that the order that the tracks are seen is solely determined by the order the results are returned from the sql dB.


- ncarthy - 2010-09-12

I reckon all that is required is something like:

Code:
Index: FileItemHandler.cpp
===================================================================
--- FileItemHandler.cpp    (revision 33661)
+++ FileItemHandler.cpp    (working copy)
@@ -225,6 +225,8 @@
   CVideoLibrary::FillFileItemList(param, list);
   CFileOperations::FillFileItemList(param, list);

+  Sort(list, param);
+
   return true;
}



- brunick - 2010-09-12

hey, i've followed this thread a while, but i've not come across a solution to the navigation problem. is it possible in the final dharma that you can send keyboard keys or like "up" "back" or "menu" with the json rpc?

oh and i think i found a bug:
when you try to play a file which has moved the whole system stops until you've clicked the "missing file" dialog on the server


- ncarthy - 2010-09-13

You can always use the eventserver api for these kind of commands. It's UDP based so minimal overhead, very fast.

There are example clients here: http://xbmc.svn.sourceforge.net/viewvc/xbmc/trunk/tools/EventClients/


- topfs2 - 2010-09-13

ncarthy Wrote:I reckon all that is required is something like:

Code:
Index: FileItemHandler.cpp
===================================================================
--- FileItemHandler.cpp    (revision 33661)
+++ FileItemHandler.cpp    (working copy)
@@ -225,6 +225,8 @@
   CVideoLibrary::FillFileItemList(param, list);
   CFileOperations::FillFileItemList(param, list);

+  Sort(list, param);
+
   return true;
}

Definatly put it on trac but I think the best way is to make it go through the entire HandleFilelist method which would allow sort, start and end.


- MKay - 2010-09-18

Hi,

i like the new api, but i have some annotations:

1. Playlist.Remove does not work (The other people already mentioned that. Rolleyes ). It would be nice if this would be implemented.

2. GetShares / GetRootDirectory does not work.

3. It's possible to add a folder to the playlist:
Code:
'{"method": "AudioPlaylist.Add", "params": { "file": "/media/usb/mp3" }}'
But the API will not add the files (inside the folder) itself to the playlist.

4. I use the following code to add a file to the playlist:
Code:
'{"method": "AudioPlaylist.Add", "params": { "file": "/media/usb/mp3/track.mp3" }, "id": 1}'
This works fine, but then AudioPlaylist.GetItems returns no song-information like artist, label etc. with this command:
Code:
'{"method": "AudioPlaylist.GetItems", "params": { "fields": ["title", "album", "artist", "duration"] }}'
The response is:
Code:
id: 1
jsonrpc: 2.0
result:
     current: 0
     end: 1
     items:
          0:
               fanart: special://masterprofile/Thumbnails/Video/Fanart/f58940e3.tbn
               file: /media/usb/mp3/Track.mp3
               label:
     paused: false
     playing: true
     start: 0
     total: 1
It would be nice, if this can be fixed. Laugh

5. A method to toggle shuffle-mode would be nice Big Grin

6. The GetXYZInfo-methods are not implemented yet.

Greets,
MKay


Item 4 - ncarthy - 2010-09-18

Hi,

I can't answer for items 1-3 on your list but with item 4 I know you won't see any information unless that file is in the music or video database. So just add it and re-run your query.


- MKay - 2010-09-18

Yes that's right, but i want to play for example music from an usb-stick without adding the files to the database ;-)
The old HTTP API had a method for this: AddToPlayList(...).


- ncarthy - 2010-09-18

hmm, I see now.:o I've looked at the http api method but it doesn't seem to do any extra processing of metadata.

Have you tried using Playlist.Add instead of AudioPlaylist.Add?


- MKay - 2010-09-19

Playlist.Add returns an error :-)
AudioPlaylist.Add works, but with the problem that no information (Artist, Title etc.) about the files is returned when using AudioPlaylist.GetItems.


- alex84 - 2010-09-19

Hi i recently updated to dharma. On camelot i was running an python script from my nas when an movie was finished to issue an update library.

Update.py
Code:
#!/usr/bin/python
import urllib
urllib.urlopen("http://user:[email protected]:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)").close()

This updated my library. I wonder if i would be able to achive the same thing with the new json?

Best regards


- rkpat_dallas - 2010-09-22

Hi, I'm very new to XBMC, and i really need some help. I am trying to use XBMC to play videos on a PC, but I want to control the playlist from another PC. i assume i need to use JSON-RPC to initiate the playlist and play/pause/stop etc.

I am completely clueless how to get started. can some one help me get started? i am proficient w/ .NET and plan to use it. but have no idea where to start. Please help...


- topfs2 - 2010-09-22

you can use xbmc-send or the webinterface if you don't want to program it


- Therms - 2010-09-26

Feature request.

I'm not sure if this is even possible, but I'd be in heaven if I could add and remove single tv shows and movies from the library via JSON-RPC instead of doing a blanket VideoLibrary.ScanForContent