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)



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - doozer - 2012-08-10

(2012-08-10, 04:52)dwagner Wrote:
(2012-08-10, 04:31)doozer Wrote: Can anyone point out what I'm doing wrong here? I've simplified the call as much as possible.

The tvshowid is valid and was returned by a previous call to VideoLibrary.GetEpisodes.

Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShowDetails", "params": {"tvshowid": 1882,"properties": ["title"]}, "id": "VideoLibrary.GetTVShowDetails"}
I've copy pasted your code and tested it on my OSX XBMC Eden (I just changed the tvshowid to a valid one in my library) and it worked perfectly for me. The only time I got the error you mentioned was when I put an invalid tvshowid.

Hmmm, OK. Thanks, I shall triple check the tvshowid is valid.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - doozer - 2012-08-10

(2012-08-10, 05:24)doozer Wrote:
(2012-08-10, 04:52)dwagner Wrote:
(2012-08-10, 04:31)doozer Wrote: Can anyone point out what I'm doing wrong here? I've simplified the call as much as possible.

The tvshowid is valid and was returned by a previous call to VideoLibrary.GetEpisodes.

Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShowDetails", "params": {"tvshowid": 1882,"properties": ["title"]}, "id": "VideoLibrary.GetTVShowDetails"}
I've copy pasted your code and tested it on my OSX XBMC Eden (I just changed the tvshowid to a valid one in my library) and it worked perfectly for me. The only time I got the error you mentioned was when I put an invalid tvshowid.

Hmmm, OK. Thanks, I shall triple check the tvshowid is valid.


Yep it appears I was passing an episodeid rather than a tvshowid. Doh! Thanks for the help.



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-08-10

(2012-08-10, 00:56)dwagner Wrote: The problem is with the OSX build. I tried the latest OSX and Windows builds. The OSX build crashed on JSONRPC.Introspect and the Windows build did not. There are other JSON commands that crash for me on OSX. I read an earlier post where you mentioned you are going to try and test on OSX, so I guess it will be sorted once you get a chance to do that.

I've come right with my trac account again. Though if you already have a trac about the OSX JSON then there is no need for me to post a new issue.

Please create a bug report for this and mention all the methods that crash for you on OSX and if possible provide a log of when the crash happens. I don't have OSX so I won't be able to test this myself. I'll have to find someone else on the team to do the testing for me but I'm the only ony working on JSON-RPC so it won't be easy.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-08-10

(2012-08-10, 00:56)dwagner Wrote: The problem is with the OSX build. I tried the latest OSX and Windows builds. The OSX build crashed on JSONRPC.Introspect and the Windows build did not. There are other JSON commands that crash for me on OSX. I read an earlier post where you mentioned you are going to try and test on OSX, so I guess it will be sorted once you get a chance to do that.

I've come right with my trac account again. Though if you already have a trac about the OSX JSON then there is no need for me to post a new issue.

Do these crashes happen over HTTP or over TCP or over both? Would be important to know whether the crashes are transport-dependent or transport-agnostic (you can also try websockets if you want). If the crashes happen on all transports it's a problem with JSON-RPC or the JSON reader/writer. Otherwise it's a problem with the transport itself.




RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2012-08-10

(2012-08-09, 23:39)Montellese Wrote: night199uk is working on re-organizing the musicdatabase. The problem with the "artistid" is/was that an album can have more than one artist but the artistid only returned one value. As a "replacement" you can now call AudioLibrary.GetArtists with a "filter" parameter containing either a "albumid" property or a "songid" property (which is not possible in Eden) and you'll get a list of all artists of a specific album/song.

Ok, is see this should do the trick since in my case I need to retrieve the artistid from a given songid.

Just out of curiosity. Why does AudioLibrary.GetSongs not return a list of artist id's instead of a single artistid like it was changed for the "genre" in the newest nightly builds? Are there some technical limitations that would make the data retrieval slow? Before AudioLibrary.GetSongs was really nice since I returned all attributes that I need and I could sync my local db with just one request. Luckily I currently only need the artistid to retrieve artist covers so the missing artistid is not really an issue for me




RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-08-10

Because we are still in a transition process and I for one don't know how the final database schema will look like so I don't wanna hack something in now that needs to be changed later again. If it will be possible to provide an array of artistids once all the changes have been made I'll re-add that functionality.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2012-08-10

Ok, thanks that makes sense


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - tim2005 - 2012-08-10

Are there people out here working on a Portable Class Library using (WebSocket) JSON-RPC for .NET apps? Currently working on it but having a hard time to figure out how to do the mapping from JSON strings to .NET classes and visa-versa.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-11

Hi there,

I got some strange reports on Yatse about media not syncing with a strange error "com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0x92"
(Jackson is one of the most robust and used Json library)

I'm in the process of getting an Xbmc database that causes this error but it seems it happens primarily on tvepisodes / movies plot, from the error it seems this fields in not correctly UTF encoded in some cases.

Is this a known problem ? in Eden and Frodo ?



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-11

I finally got the database and it seems that's it the data in database that is not good and I suppose the json part suppose the data is correct UTF and does not do another utf encode Sad

How is non valid UTF be stored in database ? If this can happens shouldn't the Json part ensure that it sends correct data ?

A screen shot of the database content : http://yatse.leetzone.org/Images/utf.png


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-11

And another question that have nothing to do with that Smile

What is the recommended way to get pictures thumbs for Frodo ?
It seems there's no way for Eden other than getting the real image via preparedownload and vfs.

But for Frodo if VFS is removed ?

Should I make a FR so that the thumbnail properties is filled in GetDirectory for media = pictures ?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2012-08-11

If I understood correctly what Montellese said, VFS will still work in Froyo for thumbs

(2012-08-09, 23:39)Montellese Wrote: Files.PrepareDownload will fail on anything except cached images. The problem with access to media files is that it is very difficult to draw a line of what should be accessible and what not. Every user would probably provide you with a different answer so for now only providing access to the cached images is the safest solution. Hopefully there will be ways to access media files managed by XBMC in the future but we haven't thoroughly discussed this yet.



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Martijn - 2012-08-11

(2012-08-11, 23:35)Millencolin007 Wrote: If I understood correctly what Montellese said, VFS will still work in Froyo for thumbs

(2012-08-09, 23:39)Montellese Wrote: Files.PrepareDownload will fail on anything except cached images. The problem with access to media files is that it is very difficult to draw a line of what should be accessible and what not. Every user would probably provide you with a different answer so for now only providing access to the cached images is the safest solution. Hopefully there will be ways to access media files managed by XBMC in the future but we haven't thoroughly discussed this yet.

But can be removed before Frodo is released with another method


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-11

Yep for media thumbs we can use the /image that replace the /vfs and this one will stay with welcomed additions like resizing Smile

My problem is more about real pictures that are not seen as real media and can only be listed with Files.GetDirectory, those files does not send back a type of pictures and so does not set the thumbnail value in the replies.

So no way to get preview of those from remotes unless getting the full image from VFS. This is the same problem as getting the mp3 for your app.
While for mp3 I suppose you can switch to upnp or other streaming methods, for listing pictures this does not seems like a possible solution so I'm wondering about this specific one.

The easy solution would have been to send back picture type and thumbnails in the GetDirectory responses.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-12

And to finish for today, another very small bug that might worth being corrected for Frodo.

When doing a Files.GetDirectory with media set to movie on a directory with movies scanned to Xbmc databases with an organization of 1 movie by folder, the response list the directories as recognized movies with a correct type of movie and set the filename directly to the movie but leaves the FileType attribute to directory instead of file.

For example :

Code:
{"id":1,"jsonrpc":"2.0","method":"Files.GetDirectory","params":{"media":"video","directory":"Z:\\Films\\","properties":["title","thumbnail","fanart","rating","genre","artist","track","season","episode","year","duration","album","showtitle","playcount"]}}

Gives the result :

Code:
{"id":1,"jsonrpc":"2.0","result":{"files":[{"album":"","artist":"","episode":-1,"fanart":"image://Z%3a%5cFilms%5c13%20fant%c3%b4mes%20(Thir13en%20Ghosts)%20%5b720p%5d%20%5b2002%5d%5cfanart.jpg","file":"Z:\\Films\\13 fantômes (Thir13en Ghosts) [720p] [2002]\\13 fantômes.bluray.720p.2002.mkv","filetype":"directory","genre":"","id":7,"label":"13 fantômes","playcount":1,"rating":5.0999999046325684,"season":-1,"showtitle":"","thumbnail":"image://Z%3a%5cFilms%5c13%20fant%c3%b4mes%20(Thir13en%20Ghosts)%20%5b720p%5d%20%5b2002%5d%5cmovie.tbn","title":"13 fantômes","track":-1,"type":"movie","year":2002},{"album":"","artist":"","episode":-1,"fanart":"image://Z%3a%5cFilms%5c13%20jeux%20de%20mort%20(13%20game%20Sayawng)%20%5b720p%5d%20%5b2006%5d%5cfanart.jpg","file":"Z:\\Films\\13 jeux de mort (13 game Sayawng) [720p] [2006]\\13 jeux de mort.720p.2006.mkv","filetype":"directory","genre":"Thriller","id":8,"label":"13 jeux de mort","playcount":0,"rating":5,"season":-1,"showtitle":"","thumbnail":"image://Z%3a%5cFilms%5c13%20jeux%20de%20mort%20(13%20game%20Sayawng)%20%5b720p%5d%20%5b2006%5d%5cmovie.tbn","title":"13 jeux de mort","track":-1,"type":"movie","year":2006},{"album":"","artist":"","episode":-1,"fanart":"image://Z%3a%5cFilms%5c2%20Fast%202%20Furious%20(2%20Fast%202%20Furious)%20%5b720p%5d%20%5b2003%5d%5cfanart.jpg","file":"Z:\\Films\\2 Fast 2 Furious (2 Fast 2 Furious) [720p] [2003]\\2 Fast 2 Furious.hddvd.720p.2003.mkv","filetype":"directory","genre":"Action / Crime / Thriller","id":4,"label":"2 Fast 2 Furious","playcount":1,"rating":5.0999999046325684,"season":-1,"showtitle":"","thumbnail":"image://Z%3a%5cFilms%5c2%20Fast%202%20Furious%20(2%20Fast%202%20Furious)%20%5b720p%5d%20%5b2003%5d%5cmovie.tbn","title":"2 Fast 2 Furious","track":-1,"type":"movie","year":2003},{"album":"","artist":"","episode":-1,"fanart":"image://Z%3a%5cFilms%5c2012%20(2012)%20%5b720p%5d%20%5b2009%5d%5cfanart.jpg","file":"Z:\\Films\\2012 (2012) [720p] [2009]\\2012.720p.2009.mkv","filetype":"directory","genre":"","id":20,"label":"2012","playcount":0,"rating":6,"season":-1,"showtitle":"","thumbnail":"image://Z%3a%5cFilms%5c2012%20(2012)%20%5b720p%5d%20%5b2009%5d%5cmovie.tbn","title":"2012","track":-1,"type":"movie","year":2009}

As you see file attributes are set to a file in subdirs since movie is in database so referring to a direct file but the result also contain : "filetype":"directory" witch should mean that you can go down a level in the returned file attribute witch is obviously not possible.

The correct behavior should to have the filetype set to file. (Or to send back only the directory so we could go in but I don't think this would make sense for full real browsing we should use the media:files ).