JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC

  Thread Rating:
  • 8 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
topfs2 Offline
Team-XBMC Developer
Posts: 4,011
Joined: Dec 2007
Reputation: 10
Post: #316
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 }

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
ncarthy Offline
Junior Member
Posts: 32
Joined: Aug 2010
Reputation: 0
Location: London
Post: #317
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.
find quote
ncarthy Offline
Junior Member
Posts: 32
Joined: Aug 2010
Reputation: 0
Location: London
Post: #318
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;
}
find quote
brunick Offline
Junior Member
Posts: 1
Joined: Sep 2010
Reputation: 0
Post: #319
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
find quote
ncarthy Offline
Junior Member
Posts: 32
Joined: Aug 2010
Reputation: 0
Location: London
Post: #320
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/x...ntClients/
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 4,011
Joined: Dec 2007
Reputation: 10
Post: #321
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.

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
MKay Offline
Member
Posts: 81
Joined: Jan 2010
Reputation: 10
Post: #322
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
(This post was last modified: 2010-09-18 21:59 by MKay.)
find quote
ncarthy Offline
Junior Member
Posts: 32
Joined: Aug 2010
Reputation: 0
Location: London
Post: #323
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.
find quote
MKay Offline
Member
Posts: 81
Joined: Jan 2010
Reputation: 10
Post: #324
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(...).
find quote
ncarthy Offline
Junior Member
Posts: 32
Joined: Aug 2010
Reputation: 0
Location: London
Post: #325
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?
find quote
MKay Offline
Member
Posts: 81
Joined: Jan 2010
Reputation: 10
Post: #326
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.
find quote
alex84 Offline
Senior Member
Posts: 180
Joined: Jan 2010
Reputation: 2
Location: Sweden
Post: #327
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:pass@192.168.1.1: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

---------------------------------------------------
Intel NUC Haswell D34010WYK | ATV2 | Logitech Harmony One | Onkyo TX-NR808 Receiver | QNAP 809 | APC Back-UPS RS 550
find quote
rkpat_dallas Offline
Junior Member
Posts: 5
Joined: Sep 2010
Reputation: 0
Post: #328
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...
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 4,011
Joined: Dec 2007
Reputation: 10
Post: #329
you can use xbmc-send or the webinterface if you don't want to program it

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
Therms Offline
Senior Member
Posts: 120
Joined: Dec 2008
Reputation: 0
Post: #330
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
(This post was last modified: 2010-09-26 23:36 by Therms.)
find quote
Post Reply