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)



- Montellese - 2011-04-18

An FYI for everyone using the latest JSON-RPC version: I noticed a bug yesterday in all XXXLibrary.GetXXXDetails() methods which returned an array containing a single details object instead of just a details object. I fixed this in commit 6281a057c5 so you'll have to adjust your output parser for those methods. Sorry for the inconvenience.


- Montellese - 2011-04-18

And another FYI: Please check http://forum.xbmc.org/showthread.php?tid=98551 for the latest changes (I'm sure you'll like them Big Grin).


- mzanetti - 2011-04-18

Montellese Wrote:(I'm sure you'll like them Big Grin).

Indeed Big Grin

Any chance you could have a look at my Files.GetDirectory() + AudioPlaylist.AddItems() problem? I'd really like to complete the last.fm support in my app.

Btw: everyone having a N900 or some other device with Qt 4.7 on it (unfortunately no Symbian yet, but I will address this soon) is welcome to test and give feedback (It is still under heavy development, but you can see where I'm going)

https://gitorious.org/xbmcremote


- Montellese - 2011-04-19

mzanetti Wrote:Any chance you could have a look at my Files.GetDirectory() + AudioPlaylist.AddItems() problem? I'd really like to complete the last.fm support in my app.

What is the problem with Files.GetDirectory()?

The problem with missing metadata when playing a file using its path is well known but hasn't been addressed yet. The problem with special paths is not very high on my TODO list because of three reasons:
1. It's not a main use case
2. There are much more important bugs/feature requests
3. I don't even really know what LastFM is and I never use such stuff so I'd need a lot of time till I know how it works and how to test it before I can even start analysing the bug

But I would advise you to create a bug report (best with providing a description of how to test it) for it because I already forgot about it since you reported it.


- erhnam - 2011-04-19

topfs2 Wrote:Advanced settings is planned, will probably have to wait until version 2 though since it needs some alterations in advancedsettings handling.

Keymaps, I'd rather alter how input works and make a context driven input system and add mapping in gui (like games).

Hey topfs2,

Any news on this subject? I'm very interested in changing the audio output settings by using json-rpc. Do you know if this is possible?


- mzanetti - 2011-04-19

Montellese Wrote:What is the problem with Files.GetDirectory()?

I meant the problem with the missing metadata when playing a file using its path...

Montellese Wrote:The problem with missing metadata when playing a file using its path is well known but hasn't been addressed yet. The problem with special paths is not very high on my TODO list because of three reasons:
1. It's not a main use case
2. There are much more important bugs/feature requests
3. I don't even really know what LastFM is and I never use such stuff so I'd need a lot of time till I know how it works and how to test it before I can even start analysing the bug

But I would advise you to create a bug report (best with providing a description of how to test it) for it because I already forgot about it since you reported it.

Here you go: http://trac.xbmc.org/ticket/11458
I understand that there might be other issues with higher priority. Anyways, I'll support you as much as I can once you find the time to address this. I have also created a last.fm account and a step-by-step instruction for you to get easily up and running with it.

Should I also create a ticket for the missing metadata issue or is that well-known enough already?

Thanks a lot. The JSONRPC API already really rocks.


- Montellese - 2011-04-19

mzanetti Wrote:Here you go: http://trac.xbmc.org/ticket/11458
I understand that there might be other issues with higher priority. Anyways, I'll support you as much as I can once you find the time to address this. I have also created a last.fm account and a step-by-step instruction for you to get easily up and running with it.
Thanks, such a detailed description will help a lot to track down the problem once I (or someone else) find the time to look at it.

mzanetti Wrote:Should I also create a ticket for the missing metadata issue or is that well-known enough already?.
I think there already is a trac ticket for it (will have to take a look later).


- _Andy_ - 2011-04-20

Hello

Last year i developed an app to control XBMC. I used JSON-RPC. Now i want to continue my project but the json string isn't working anymore.
I used {"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"fields": ["year","genre","runtime","episode","season","fanart","plot"],"sort":{"method":"label","order":"ascending"}},"id": 1}

As response i get {"error":{"code":-32602,"data":{"method":"VideoLibrary.GetMovies","stack":{"message":"array expected for array element at index 3 but array received","name":"fields","property":{"message":"Received value does not match any of the defined enum values","type":"string"},"type":"array"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"}

What do i have to change to get this query running again?

Thank you.


- topfs2 - 2011-04-20

_Andy_ Wrote:Hello

Last year i developed an app to control XBMC. I used JSON-RPC. Now i want to continue my project but the json string isn't working anymore.
I used {"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"fields": ["year","genre","runtime","episode","season","fanart","plot"],"sort":{"method":"label","order":"ascending"}},"id": 1}

As response i get {"error":{"code":-32602,"data":{"method":"VideoLibrary.GetMovies","stack":{"message":"array expected for array element at index 3 but array received","name":"fields","property":{"message":"Received value does not match any of the defined enum values","type":"string"},"type":"array"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"}

What do i have to change to get this query running again?

Thank you.

Take a look at JSONRPC.Introspect (and read http://forum.xbmc.org/showthread.php?tid=98551). According to the stacktrace one of the fields is wrong.


- Montellese - 2011-04-20

_Andy_ Wrote:{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"fields": ["year","genre","runtime","episode","season","fanart","plot"],"sort":{"method":"label","order":"ascending"}},"id": 1}
Please post JSON code in the [ CODE ][ /CODE ] tags for easier reading.

_Andy_ Wrote:What do i have to change to get this query running again?

Did you actually take a closer look at the error you get? It tells you precisely where the error is in your request (apart from the "array" in the error message which should be "string", but I'll fix that asap).

Here the error message is again in pretty printing:
Code:
{
  "error": {
    "code": -32602,
    "data": {
      "method": "VideoLibrary.GetMovies",
      "stack": {
        "message": "array expected for array element at index 3 but array received",
        "name": "fields",
        "property": {
          "message": "Received value does not match any of the defined enum values",
          "type": "string"
        },
        "type": "array"
      }
    },
    "message": "Invalid params."
  },
  "id":1,
  "jsonrpc":"2.0"}
It tells you exactly that the field with index 3 in the "fields" array (so it's the 4th field as it starts counting at 0) is not valid. As a hint: Does it make any sense to request "episode" and "season" for movies Wink

You should probably read up on the latest changes here http://forum.xbmc.org/showthread.php?tid=98551 and also take a look at the new JSONRPC.Introspect.

EDIT: topfs2 was quicker.


- Kabooga - 2011-04-20

I do find the error message very helpful for debugging.

Thank you guys for the excellent work on the newest JSON-RPC changes.

Cheers


- Kabooga - 2011-04-21

Quick question:
In the HTTP API command AddToPlayList(media;[playlist];[mask];[recursive]) it allowed all the files in a directory tree of type [mask] to be added to the playlist using the [recursive] flag. This made it very easy to add many songs at once.

Using AudioPlaylist.Add I can successfully add a single file but I cannot find a way to add a full directory as I could with the AddToPlayList command. I've looked through the retrospect but cannot find a way to do this. Is there a parameter I am missing?

Using Nightly build 19-Apr-2011 09:50.

Example below.

Code:
"{"jsonrpc":"2.0","method":"AudioPlaylist.Add","params":{"item":{"file":"C:\\Documents and Settings\\All Users\\Documents\\My Music\\Enya\\A Day Without Rain\\"}},"id":1}"

Cheers.


- topfs2 - 2011-04-21

Nah you can't do that, I guess we could allow you to add directory=/foo/bar/. The more "correct" way is to use album or artist ids instead, i.e. Add(albumid=X), that will add the entire album no matter if its spread out over multiple locations and in the correct order.


- Kabooga - 2011-04-21

The use of id's for albums, artists, songs for adding to the playlist assumes that all wanted playable sound files are contained in the audio library.

Some of the users of my app use XBMC to play their recorded music. These files are not contained in the audio library. Some of the directories to be added can hold dozens of sound files. Adding their complete show through a single API call is very, very useful.


- Kabooga - 2011-04-21

The use of id's for albums, artists, songs for adding to the playlist assumes that all wanted playable sound files are contained in the audio library.

Some of the users of my app use XBMC to play their recorded music. These files are not contained in the audio library. Adding their complete show through a single API call is very, very useful.