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

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



- dbrobins - 2010-10-20 22:50

Montellese Wrote:Did anyone else notice a strange behaviour of the "rating" field when using AudioLibrary.GetSongs()? I always get
Code:
"rating": 48
for all songs. It works fine for AudioLibrary.GetAlbums() but I noticed that this one is handled differently in the JSON RPC code:
Code:
if (item->IsAlbum() && item->HasProperty(field))
{
  if (field == "album_rating")
    object[field] = item->GetPropertyInt(field);
  else
    object[field] = item->GetProperty(field);
}

Or is there a reason that the value is 48 for every song? I check the "song" table in the MyMusic7.db database file and saw that most of the songs have a rating of 0.

Heh, looks like it's using the ASCII value somehow (48 = ASCII code for '0'). Check if it's in Trac, and if not, file a bug (and a patch, if possible).


- Montellese - 2010-10-21 22:18

dbrobins Wrote:Heh, looks like it's using the ASCII value somehow (48 = ASCII code for '0'). Check if it's in Trac, and if not, file a bug (and a patch, if possible).

Yeah you are right I noticed it myself after I got 51 for an album and checked the database and saw that the actual value was 3.

I have created a ticket in Trac with a patch attached to it: http://trac.xbmc.org/ticket/10562


- Montellese - 2010-10-22 20:53

It's me again (you guys must hate my questions by now, sorry...)

I just looked at the VideoLibrary.GetMusicVideos() method and saw that you can specify an "artistid" and/or an "albumid" so I went ahead, got myself the ID from an artist using AudioLibrary.GetArtists() and tried to get their music videos (I double checked to use an artist which really has music videos in the library). But JSON RPC always returned "null". So I checked the code and the database and saw that the "artistid" is taken from the "actor" table in the video database. But as far as I know until now there is no way to be able to access actors in any way over JSON RPC API.
I guess the problem arises because the musicvideos table and the artists table are in two different databases and therefore you can't simply run a join statement on them.

Is this a know behaviour and is there a way around it or is this unintended?

Thanks for your help and support.


- dbrobins - 2010-10-22 23:14

Montellese Wrote:I guess the problem arises because the musicvideos table and the artists table are in two different databases and therefore you can't simply run a join statement on them.

Is separation of databases like that a design decision (for concurrent access or somesuch) or was it evolutionary? I suppose the question I'm asking is, if I made a patch to combine the databases into one (renaming conflicts), would I have trouble doing so, or is there a good reason not to do so? Besides fixing the join issue, it may make it easier to use other database systems.


- Montellese - 2010-10-23 08:58

dbrobins Wrote:Is separation of databases like that a design decision (for concurrent access or somesuch) or was it evolutionary? I suppose the question I'm asking is, if I made a patch to combine the databases into one (renaming conflicts), would I have trouble doing so, or is there a good reason not to do so? Besides fixing the join issue, it may make it easier to use other database systems.

I have no clue why there are multiple databases (well someday you'll have to decide for either one of them) but I don't think that rewriting it will be worth the effort because there already is a proposal (work in progress) for a new database schema at http://forum.xbmc.org/showthread.php?tid=73831 (but of course you know that as you have also posted there Wink)


- dbrobins - 2010-10-23 13:27

Montellese Wrote:I have no clue why there are multiple databases (well someday you'll have to decide for either one of them) but I don't think that rewriting it will be worth the effort because there already is a proposal (work in progress) for a new database schema at http://forum.xbmc.org/showthread.php?tid=73831 (but of course you know that as you have also posted there Wink)

My thought was that incremental changes would be better than one big and potentially destabilizing change. E.g., fix up column names (get rid of the cxxs) in one; ensure table names are unique across databases in another; then merge databases; add appropriate foreign keys; etc. Firnsy encouraged incremental changes in the thread you refer to, even with the potential new schema, and the new "4.0a" schema can be reached incrementally yet offers several advantages over the current schema (and over an EAV/CR model too, for that matter).


- vaton4 - 2010-10-24 01:13

topfs2 Sorry to bother so busy and important people Smile
Quote:this is development thread about jsonrpc, not webinterface.
In the XBMC/addons/webinterface.default/js/NowPlayingManager.js file there is a lot of functions like:

Code:
nextTrack: function() {
  if (this.activePlayer) {
    jQuery.post(JSON_RPC + '?SkipNext', '{"jsonrpc": "2.0", "method": "' + this.activePlayer + 'Player.SkipNext", "id": 1}',     jQuery.proxy(function(data) {
      if (data && data.result == 'OK') {
        //this.updateAudioPlaylist(true);
      }
    }, this), 'json');
  }
},
so if I am not totally stupid, it is JSONRPC application Confused?

Quote:And before you post again, please read through the docs about how to submit a proper bugreport
I am not reporting bug - I am asking DEVELOPPERS to take care for users !!
Or you develop this just for yourself ? OK, I will be quiet. Forget those idiots who use XBMC.


- topfs2 - 2010-10-24 02:40

vaton4 Wrote:topfs2 Sorry to bother so busy and important people Smile

I'm not sure if your sarcastic or honest?

vaton4 Wrote:so if I am not totally stupid, it is JSONRPC application Confused?

Web interfaces can be jsonrpc clients, however this thread is specifically about the jsonrpc API, which means that if you use it for a client or wonder stuff about the API then ask away. Your question / statement was regarding the webinterface, if it uses jsonrpc or not doesn't matter. And I didn't mean to take a swing at you, just wanted to say that you might get more attention in a proper end user thread and not in the developer thread, here we can't help you with your concerns.

vaton4 Wrote:I am not reporting bug - I am asking DEVELOPPERS to take care for users !!
Or you develop this just for yourself ? OK, I will be quiet. Forget those idiots who use XBMC.

No point in asking it in jsonrpc API thread again, its not meant to be for end users, its meant to be to developers. If you want to ask developers of skins to be more user friendly would you state that in the thread about how to format the xml's of the skins?

Again, I'm not trying to put you down, just trying to get you to ask it in the correct place so you'll reach the people you want.

Also I am taking my masters in, amongst other things, designing applications for users and I am always trying to make applications as good as possible for all sorts of users. I would say that most of the xbmc community is really striving to make an application that is as simple as possible. So I'm actually abit offended.


- topfs2 - 2010-10-24 02:46

@Montellese and dbrobins

If artistid is not same on music and music video, which it probably is not I'd suggest adding that as a trac ticket. Its not my field of expertise but I would say they should share the same ID, but thats my naive thought and it makes sense for sure that the artist ID is the same for jsonrpc requests atleast.


- Montellese - 2010-10-24 11:51

topfs2 Wrote:If artistid is not same on music and music video, which it probably is not I'd suggest adding that as a trac ticket. Its not my field of expertise but I would say they should share the same ID, but thats my naive thought and it makes sense for sure that the artist ID is the same for jsonrpc requests atleast.

I'm unsure about the ticket component in trac. Of course it is an issue which most likely will only be noticed in JSON RPC API but it generally is an issue in the whole database layout of XBMC (which I know will be improved).


- vaton4 - 2010-10-24 13:44

to topfs2: Sorry, I was a bit upset. Just want to say: if anybody is developing something new, he/she should produce not only code, but also corresponding documents for potential users. Working, user friendly, well supported applications are, after all, crucial for API success.

Yes, Dharma is still in beta stage, but a lot of people are impatient to try it. If the JSON-RPM based web interface is part of the installation (not just user-selectable add-on), it should be supported on the user level. And, sorry again, I did not found anything like that.

If you can suggest a better place to discuss this issue, let me know, please. I decided to enter this thread just because I expected the application developers talk here.
And peace forever ....


- hello_man - 2010-10-24 18:32

Hey guys, I am trying to sort the returned movies based on label but I want to not ignore "the" but it seems its not working and "the" is being ignored during sorting -

{
"fields": [
"plot",
"director",
"writer",
"studio",
"genre",
"year",
"runtime",
"rating",
"tagline",
"plotoutline"
],
"start": 0,
"end": 10,
"sort": {
"method": "label",
"order": "ascending",
"ignorethe": false
}
}


- hello_man - 2010-10-24 18:35

wiered its working when I pass "true" in "ignorethe". It seems its inverted logic. Based on the name, I would expect when passing true to ignore "the" when sorting but its doing the opposite.


- topfs2 - 2010-10-24 18:59

hello_man Wrote:wiered its working when I pass "true" in "ignorethe". It seems its inverted logic. Based on the name, I would expect when passing true to ignore "the" when sorting but its doing the opposite.

Ooops, seems like some invert yeah. I'll fix it up in asap


- Therms - 2010-10-25 22:04

Are the current methods listed by Introspect the only methods that will make Dharma final?

Any chance an ExecBuiltIn will be making it in soon?