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 - Milhouse - 2013-10-04

Something must have broken since then, as:

Code:
{
  "jsonrpc": "2.0",
  "params": {
    "art": {
      "clearart": "null",
      "clearlogo": "http://assets.fanart.tv/fanart/movies/19908/hdmovielogo/zombieland-5145e97ed73a4.png"
    },
    "movieid": 312
  },
  "method": "VideoLibrary.SetMovieDetails"
}

results in:
Code:
[
  {
    "movieid": 312,
    "title": "Zombieland",
    "art": {
      "fanart": "image://nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip]-fanart.jpg/",
      "poster": "image://nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip]-poster.jpg/",
      "clearart": "image://null/",
      "clearlogo": "image://http://assets.fanart.tv/fanart/movies/19908/hdmovielogo/zombieland-5145e97ed73a4.png/"
    },
    "file": "nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip].mkv",
    "label": "Zombieland"
  }
]



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Martijn - 2013-10-04

if you use:
PHP Code:
"clearart""null" 
it will indeed think that's an actual image link Smile
my code is a bit missleading as i had to add the 'null' to be able to pass it to the other code


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2013-10-04

(2013-10-04, 11:20)Martijn Wrote: if you use:
PHP Code:
"clearart""null" 
it will indeed think that's an actual image link Smile
my code is a bit missleading as i had to add the 'null' to be able to pass it to the other code

I've tried just about every combination - with/without quotes! Didn't think your version would work (the result was entirely expected) but I gave it a shot anyway! Smile

It seems that any attempt to pass an empty string ("") or null/None will fail.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2013-10-05

Note that I've confirmed the same behaviour in Frodo 12.2: "", None, null all return an error, and setting a single member of art[] does not remove the remaining members.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jmarshall - 2013-10-05

This is likely due to CVideoDatabase::SetArtForItem() basically just iterating through the art you pass in and adding each item. i.e. there's no removal (just replacement). Given the way that we might go and look for more art if it turns out to be not in the database at all (e.g. no fanart entry at all) it might be wise to define empty/None as being clear.

If so, all that needs doing is making sure JSON-RPC supports this. By the looks it's intentionally non-empty currently:

https://github.com/xbmc/xbmc/blob/master/xbmc/interfaces/json-rpc/types.json#L359

@Montellese I'm sure will let us know whether this can be changed to a string or not.

Jonathan


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2013-10-05

(2013-10-05, 05:06)jmarshall Wrote: it might be wise to define empty/None as being clear.

Thanks Jonathan. Do you mean "clear" as in, "interpet this artwork item as not being set" (while still writing it to the database, albeit empty), or "clear" as in "remove the item when updating the database"?

Although the former would be fine (I think - it would depend on how other add-ons are testing if a value exists), it would be nice to have the option to be able to remove those items that you don't want/need in the database. Ideally it would be possible to give an item a value such as None (or null) meaning that the item won't then be written back to the database, effectively removing it.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jmarshall - 2013-10-05

Yes, I think we could remove them. I was initially hesitant about doing so, because if XBMC finds no art at all for an item then it will go and grab local art. As long as there's one, though, it should be OK.

So yeah, the ability to specify None or null rather than just the empty string (though we could just as well interpret the empty string as meaning remove).

Let's wait and see what Montellese thinks.

Cheers,
Jonathan


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2013-10-05

IMHO empty string ("") should continue to be interpreted as just that, and the item left in the database - there's plenty of examples where fields exist today that are set to the empty string (eg. lastplayed, trailer etc.) which could cause problems if they suddenly started disappearing from the database.

null/None on the other hand is fairly unambiguous, and a suitable trigger for removal.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jmarshall - 2013-10-05

I wasn't suggesting applying empty string -> remove for everything. Just for art. But agreed that None/null is less ambiguous.


AW: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2013-10-05

Supporting null (and empty strings) in the interface is certainly possible. The question is how to pass the null value on to CVideoDatabase since it expects a map<string,string>.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jmarshall - 2013-10-05

Either pass as empty string, or (better) add a ClearArtForItem()


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

So there would be logic in JSON-RPC code that would detected the null'ed artwork types and call ClearArtForItem for those artwork types?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2013-10-06

Hi
There is a way to get the actual XBMC profile using JSON ? I need to identify what profile is running and then create some actions based on that, the user have two profiles, one for music and another for movie. I tried to found, but no luck until now.
Very thanks
Clayton


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

(2013-10-06, 00:56)claymic Wrote: Hi
There is a way to get the actual XBMC profile using JSON ? I need to identify what profile is running and then create some actions based on that, the user have two profiles, one for music and another for movie. I tried to found, but no luck until now.
Very thanks
Clayton

The "Profiles" namespace has been added very recently to the gotham nightly builds.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jmarshall - 2013-10-06

Montellese: Yup, I reckon that's the best way to go.