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 - 2010-10-31

Interesting to know that the whole things works with TCP as well. Maybe I might get rid of the HTTP overhead as well.

I have a problem with AudioPlaylist.GetItems. This is the call
Code:
{
  "jsonrpc": "2.0",
  "method": "AudioPlaylist.GetItems",
  "params": {
    "fields": [
      "title",
      "artist",
      "genre",
      "year",
      "rating",
      "album",
      "tracknumber",
      "discnumber",
      "duration",
      "comment",
      "lyrics"
    ]
  },
  "id": 10
}
and this is what I get back
Code:
{
   "id" : 10,
   "jsonrpc" : "2.0",
   "result" : {
      "current" : 0,
      "end" : 11,
      "items" : [
         {
            "fanart" : "special://masterprofile/Thumbnails/Video/Fanart/baa0133a.tbn",
            "file" : "smb://***/Nickelback/All The Right Reasons/01-nickelback-follow_you_home.mp3",
            "label" : "01-nickelback-follow_you_home"
         },
         {
            "fanart" : "special://masterprofile/Thumbnails/Video/Fanart/6f944701.tbn",
            "file" : "smb://***/Nickelback/All The Right Reasons/02-nickelback-fight_for_all_the_wrong_reasons.mp3",
            "label" : "02-nickelback-fight_for_all_the_wrong_reasons"
         },
         ...
      ],
      "paused" : false,
      "playing" : true,
      "start" : 0,
      "total" : 11
   }
}

Normally I get back all/most of the requested fields. At least I always get title and artist. Does this mean that there is no metadata for these files in the XBMC database or what could be the cause?


- Tolriq - 2010-10-31

If you have added the files by filename instead of songid then you loose meta data Sad

I've reported that earlier it does that since beta 3 and even in the interface (just start a movie from the file mode instead of library and pause, most skins will show the filename instead of the movie name).


About RAW TCP i've got a stupid question, but i suppose that if you send multiple request in the same time the answer came one after another and you must use the ID to find witch answer correspond to what request. But what about announcement ?

And last question more programing oriented than JSON but since it's to try the RAW port Smile

Any idea on how to handle the RAW TCP when you have background threads that do pings and check / get now playing, and synchronous calls for database syncs or some commands sending not asynchronous ? (Well what should be the correct dev model to get corresponding data to corresponding request Smile )


- Montellese - 2010-10-31

Tolriq Wrote:If you have added the files by filename instead of songid then you loose meta data Sad

I didn't add them using JSON RPC API. It's from the log of a person testing my "XBMC on iMON Display" app. He simply started playing an album in XBMC using XBMC's interface.


- Tolriq - 2010-10-31

Surely the same problem, he was not in library mode Smile


- topfs2 - 2010-10-31

Tolriq Wrote:If you have added the files by filename instead of songid then you loose meta data Sad

I've reported that earlier it does that since beta 3 and even in the interface (just start a movie from the file mode instead of library and pause, most skins will show the filename instead of the movie name).


About RAW TCP i've got a stupid question, but i suppose that if you send multiple request in the same time the answer came one after another and you must use the ID to find witch answer correspond to what request. But what about announcement ?

And last question more programing oriented than JSON but since it's to try the RAW port Smile

Any idea on how to handle the RAW TCP when you have background threads that do pings and check / get now playing, and synchronous calls for database syncs or some commands sending not asynchronous ? (Well what should be the correct dev model to get corresponding data to corresponding request Smile )

Just to make it clear, there is no garantue in jsonrpc spec that you will get the responses in sync, this is why you have the ID.
Say I send methodX and methodY with ID 1 and 2. The responses I could get is responseY id 2 and then responseX id 1. Adding on is announcements they can happen whenever Smile They do not have ID though.

This is why for tcp you really should have a message queue and handle the responses based on ID.


- Jordan - 2010-11-01

Is it possible to update a library items's play count and current position using the json API?


- Montellese - 2010-11-02

I know I already asked if the tcp port 9090 is hardcoded in XBMC but I noticed that port 9090 is used by some other applications as well. It is even listed as the port for WebSM. A user also reported that Sabnzb+ uses it.

I think it would be nice if it could be configurable but I also know that 99% of the people will probably never touch this option...


- vaton4 - 2010-11-03

Discovered that all AudioPlayer methods which should return playing/paused status (tried State, PlayPause, GetTime, GetTimeMS) return allways playing='true', paused='true', no matter the actual player status is (tested in Dharma beta4, Windows XP). Any suggestions?


- Montellese - 2010-11-03

vaton4 Wrote:Discovered that all AudioPlayer methods which should return playing/paused status (tried State, PlayPause, GetTime, GetTimeMS) return allways playing='true', paused='true', no matter the actual player status is (tested in Dharma beta4, Windows XP). Any suggestions?

I already reported this here but it was only the "playing" status which would always show "true". "Paused" worked fine for me. I don't know if this was changed in Dharma though.


- vaton4 - 2010-11-04

Montellese Wrote:I already reported this here but it was only the "playing" status which would always show "true"...
Sorry, it was my mistake. "paused" bit is working, just "playing" is permanently true.
Anyway, BMHO the "playing" state is a bit useless as "playing" means just inversion of the "paused" (playing=not_paused, paused=not_playing). If "playing" has different meaning here, it should by explained EXACTLY in the method description!

EDIT: OK, made some experiments and found the "playing" param really usefull. Just seems to be equal to "AudioPlayer" param of Player.GetActivePlayer so its name should be something like "AudioPlayerActive", not "playing". It is misleading.


- _Andy_ - 2010-11-06

Is it possible to query the fanart of TV-Shows and movies with JSON?

If i query the thumbnail of a TV-Show i get the small banner only. I want the nice
big fanart too.

How can i get it?


- Montellese - 2010-11-07

_Andy_ Wrote:Is it possible to query the fanart of TV-Shows and movies with JSON?

When you use the methods from the Library namespaces you should get a field "fanart" alongside the "thumbnail" field.


- vaton4 - 2010-11-10

Kabooga Wrote:I'm currently going through the conversion of XBMControl_Web to use the JSON RPC API.

Hi, Kaboga
How far are you? May be I can be usefull as beta tester?


scanforcontent - clmaxwell - 2010-11-13

whoa, 50 pages! so glad there's a 'search this thread' button..
didn't find any matches, though, so here goes:

I used httpapi feature to scan for new content in a specific location, but have recently gotten the latest build installed and started porting to jsonrpc
the wiki does not show me an equivalent for scanning for new content in a single path. I have a mediacenter installation with 100+tvshows and 1000+ movies, it is not feasible to rescan the entire library every time a torrent finishes && is filed. any way to access this feature? or anything like the old execBuiltIn?
really don't want to have to duplicate effort by going straight at the SQL

thanks

CLM


- Montellese - 2010-11-13

clmaxwell Wrote:I used httpapi feature to scan for new content in a specific location, but have recently gotten the latest build installed and started porting to jsonrpc
the wiki does not show me an equivalent for scanning for new content in a single path. I have a mediacenter installation with 100+tvshows and 1000+ movies, it is not feasible to rescan the entire library every time a torrent finishes && is filed. any way to access this feature? or anything like the old execBuiltIn?
really don't want to have to duplicate effort by going straight at the SQL

You can do neither right now. There only is a method to scan the whole video or audio library and you can't do anything with SQL.