Port deprecated HTTP API to the new JSON RPC API
Old and busted: http://wiki.xbmc.org/index.php?title=Web_Server_HTTP_API New and sexy: http://wiki.xbmc.org/index.php?title=JSON_RPC
From the first link:
As of the Dharma release of XBMC, this API is deprecated. Use the JSON RPC interface instead.
What are the ramifications of this? I found out about the current situation when I was looking to find out how to implement directory sorting in file mode. Turns out sorting is only supported in the new JSON version. Looking through the code, in it's lovely MVC format, it looks like the only bits that need to change are the URL builder and data deserializer. I can't imagine it's a huge effort? I'm willing to take it on to achieve my goal of file sorting =) Busy at the moment so should have it done within the month I'd imagine. Thoughts?
Just noticed this from the latest forum update
Also the next bigger thing will be JSON-RPC support, which will hopefully result in a faster and smoother experience
Of course, this is planned and probably one of the next things. Basic support is already built-in but nothing near what it should be.
Great! Is this something available on another branch?
No, the basic support is in master. However it dealt with a very old version of JSON-RPC (1y+ ago), so not sure if anything works.
For the new dev we'll probably have our separate branch, yes.
The old stuff is probably quite close. Lots have changed in pre eden but most is rather similar (much is added and just a few parameters are fixed up). This is a good read regarding the changes http://forum.xbmc.org/showthread.php?t=98551
I know this is an old issue, but just wanted to let you know I've been working on implementing the JSON API and have much of the music subsystem finished. The player control is turning out to be a bit of a bear.
I have implemented most of the JSONRPC api for Eden and some for Frodo and submitted a pull request. If you'd like to test it out, I've uploaded an apk:
https://github.com/tthomas48/android-xbmcremote/xbmc-remote-20121024.apk/qr_code
Rather than auto-detect at this point (since you probably want to stick with HTTP if you're a heavy video/tv user), you can enable the JSONRPC API in the settings.
Thanks, I'll have a look at the code later. However, I'm just in the process of creating a code generator that produces a Java JSON-RPC library based on introspect's output. It will be complete and support all features and I'll think I'll go with it once it's finished. You can have a look at a Eden-compatible version here:
https://github.com/freezy/xbmc-jsonrpclib-android
Cool. That's much nicer. I'm definitely down with helping to wire it up when it's ready. I actually started this project mainly because my wife got really irritated with the improper sorting of articles in the http api version.
I'll be honest after banging on this for a while I think shooting for Frodo for JSONRPC integration is a better target. There's too much stuff missing in the Eden version to make it particularly worthwhile. The HTTP API is much more feature rich.
One thing that's already bit me are mp3 streams which the JSONRPC can't read the status of and the HTTP API can, not to mention missing abilities to query actors, and genres of TV shows. I'm going to try to push over on the xbmc mailing list for getting those features added for Frodo. Also working on the ability to download media items, which looks like it will be error prone on the Eden version of the API.
Yeah unless we figure out an elegant way to make libs for both versions live along together, I'll probably ditch Eden support for the next version. HTTPAPI will be completely removed in Frodo anyways.
If there's still stuff missing, let me know then we can still add it to XBMC.
HTTPAPI will be completely removed in Frodo anyways.
I think this just happened. app now throws java.io.FileNotFoundException for GetSystemInfo(120)
Ok, so I'm making some progress on a client that preserves both the http client and adds the JSON RPC client. But I got stopped by the following.
I've been having some issues with what's being reported by introspection. Is this best reported as an xbmc bug? Basically Audio.Details.Artist declares that the field "artist" is required in types.json, but you can't actually query that (at least in last night's nightly). 'label' seems to be what has replaced it. I can submit this as a bug report on xbmc if that's better. I haven't completely delved into how these json files work. Are they simply used to build the introspection or are they somehow used by xbmc?
diff --git a/xbmc/interfaces/json-rpc/types.json b/xbmc/interfaces/json-rpc/types.json
index b96be7f..ca74a8f 100644
--- a/xbmc/interfaces/json-rpc/types.json
+++ b/xbmc/interfaces/json-rpc/types.json
@@ -437,7 +437,7 @@
"extends": "Audio.Details.Base",
"properties": {
"artistid": { "$ref": "Library.Id", "required": true },
- "artist": { "type": "string", "required": true },
+ "label": { "type": "string", "required": true },
"instrument": { "$ref": "Array.String" },
"style": { "$ref": "Array.String" },
"mood": { "$ref": "Array.String" },
Try to regenerate the lib with the latest nightly, there were recent changes in there as far as I know.
Yeah, there were a bunch of changes yesterday. I was hoping they would fix the label issues, but they didn't.
On Thu, Nov 29, 2012 at 12:28 AM, freezy [email protected] wrote:
Try to regenerate the lib with the latest nightly, there were recent changes in there as far as I know.
— Reply to this email directly or view it on GitHubhttps://github.com/freezy/android-xbmcremote/issues/8#issuecomment-10836721.
Weird. I'll ask Montellese about it.
I'm not sure what the problem is. "artists" has always been (since pre-Eden) a fixed property when calling AudioLibrary.GetAritsts/GetArtistDetails i.e. it's always returned and you can't (not) request it.
I figured it out and submitted a pull request to xbmc. Basically GetArtistDetails was adding the artist field to a new parameter array, but then not actually passing that array into the field population method.
I put up a new test APK. This will more than likely take a while to merge:
https://github.com/tthomas48/android-xbmcremote/downloads
This should give you Frodo support. Make sure to check the JSONRPC API checkbox in your the host settings dialog for your Frodo hosts. It should also continue working with Eden, etc. So if you use those I'd love bug reports on that end as well.