JSON-RPC song/artist specific fields retrieval
#1
Hello everyone,

I'm developing a simple XBMC remote for Java ME (mainly for my cheap'o Nokia) and am able to communicate with the server, play/pause, skip, get all artists, etc.

My problem is, I can't seem to ask for specific fields. From the XBMC JSON Wiki:

Quote:AudioLibrary.GetArtists
Retrieve all artists
Permission: ReadData
Parameters:
[ Library.Id genreid = -1 ]
[ array fields ]
[ List.Limits limits ]
[ List.Sort sort ]
Returns:
Type: object
Optional: true
Properties:
List.LimitsReturned limits
[ array artists ]

I come up with this command, for example:

Code:
{"jsonrpc": "2.0", "method": "AudioLibrary.GetArtists", "params": {"fields": ["artistid", "label"]}, "id": 1}

All is fine, there's no error and I get the artistid and label, but I also get the fanart directory - the exact same thing I get without supplying any parameters.

I've tried all kinds of combinations of arrays and objects to supply for the params object, but nothing seems to work.

What am I doing wrong?
Reply
#2
You're not doing anything wrong, as you said you are getting a valid response.

Think of 'fields' as a request for additional information, when set you will get the default info plus whatever you specifically request.

If you're trying to use 'fields' to limit the info sent in the response, it won't do that.
Reply
#3
Just want to state what dann0 says is correct, fields just adds it does not filter. There is a set of basic fields we always fetch no matter what fields is set to.
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

"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#."
Reply
#4
Ah, of course! I hadn't thought of that. Thanks dann0 and topfs2, much appreciated!
Reply
#5
I'm trying to find if the Files.GetDirectory command has a param for only querying for directories or files. I'm currently a little frustrated with the way it responds since you get a "parrallel" list of directories AND files. So parsing on the fly is kind of clunky. This is part of a "headless" AMX module I've been developing the last night or two.

Any (positive) thoughts appreciated.

:confused2::confused2:
Reply
#6
Raginn8 Wrote:I'm trying to find if the Files.GetDirectory command has a param for only querying for directories or files. I'm currently a little frustrated with the way it responds since you get a "parrallel" list of directories AND files. So parsing on the fly is kind of clunky. This is part of a "headless" AMX module I've been developing the last night or two.

Any (positive) thoughts appreciated.

:confused2::confused2:

What is "clunky" about it? There is no way to state in the request that you are only interested in directories or files but if you are only interested in either one of them why don't you just ignore the other in the response? If files and directories would be listed in the same array (and not separated into two arrays) you would have to look at every item and decide whether it's a file or a directory so I don't see the problem with the response with 2 arrays.

PS: Next time please post your question in the JSON-RPC Development thread or start a new topic instead of hijacking a thread with a totally different question/problem. Thanks.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply

Logout Mark Read Team Forum Stats Members Help
JSON-RPC song/artist specific fields retrieval0