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 - bradvido88 - 2012-04-11

On another topic, regarding the JSON-RPC announcements.
Is there any way to find out what file was started when Player.OnPlay is sent? From what I've seen (in Eden Final), it does not give any indication about the file being played.

Sample announcement:
Code:
{"method":"Player.OnPlay","params":{"sender":"xbmc","data":{"title":"","player":{"speed":1,"playerid":1},"item":{"type":"movie"}}},"jsonrpc":"2.0"}
\


Edit:
I am using Player.GetItem to get the file for the currently playing item,which works well enough.

However, if I am playing a .strm (a playlist), is there any way to get the name of the strm/playlist instead of the currently playing file?

I couldn't seem to find a way to get the name of the currently playing playlist


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

(2012-04-03, 18:12)Mizaki Wrote: I see there are some PRs which look good. I didn't see anything about playlists. Is that still on your radar?
As soon as someone has improved/reworked the playlist handling in XBMC itself, yes.

(2012-04-03, 18:12)Mizaki Wrote: The other thing (which I'll make a feature request for if you think it's doable) is getting the library in small chunks (5, 10 etc. items). As I've mentioned before people with low(er) powered PCs with large libraries can take a long (I'm guessing 15 seconds +) time to retrieve. I guess the DB query is the thing that takes the time so the only way to grab small chunks would be without sorting. Without sorting though it does limit how useful it would be.

I'm wondering if you think it's even possible atm?
This will be possible once I have finished my work on extended filtering which will be possible by providing smartplaylist filters in JSON-RPC requests. XBMC's smartplaylists provide the possibility to already do the limitting and sorting in the database and not after having retrieved the whole list (which JSON-RPC does right now).

(2012-04-04, 20:47)joethefox Wrote: Hi all,
there a remote procedure call to obtain what user has chosen for the "Ignore article when sorting"?

Settings>Appearance>File Lists>Ignore article when sorting (e.g. "the") : ON/OFF
No JSON-RPC does not provide access to any (GUI) settings (yet).

(2012-04-08, 08:36)N3MIS15 Wrote: Montellese, are you planning on including thumbnail/fanart params to your FooLibrary.Set pull request? If so, are you also planning on making the remote images stored in the database available thru jsonrpc?
My current implementation doesn't because I have to work myself into the stuff jmarshall has done on the thumbnail/image caching so the first implementation will probably not support setting the thumbnail but later on it might be added. Not sure yet though in what way because uploading images through JSON-RPC is (currently) not possible.

(2012-04-08, 08:36)N3MIS15 Wrote: Also, while on the subject. I have been unable to change a movie set. I can only append, is there a way to replace or remove? Its quite possible im just doing something wrong, im fairly new to coding.
JSON-RPC doesn't allow you to change anything right now in XBMC's library/database.

(2012-04-09, 06:37)doozer Wrote: I'm using Playlist.GetItems to pull down the currently queued songs. This is working fine. I just tried doing a similar thing to get a list of queued movies. This also works, but I don't seem to be able to include the "movieid" value in the list. Is there a way to obtain a list of queued movies and their corresponding Library id?
Hm the "id" property should be returned independant of whether it's a video or audio playlist. I just gave it a try and I got a valid "id" property and the "type" property contains "movie" so that seems to work fine.



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

(2012-04-12, 12:06)Montellese Wrote: JSON-RPC doesn't allow you to change anything right now in XBMC's library/database.

I was refering to the FooLibrary.Set pull request. i built a copy of xbmc eden with those changes and I have been able to change everything but movie sets. I can only append them.


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

(2012-04-12, 12:06)Montellese Wrote:
(2012-04-04, 20:47)joethefox Wrote: Hi all,
there a remote procedure call to obtain what user has chosen for the "Ignore article when sorting"?

Settings>Appearance>File Lists>Ignore article when sorting (e.g. "the") : ON/OFF
No JSON-RPC does not provide access to any (GUI) settings (yet).
Waiting for this, could be feasible to obtain an automatic choice (so the GUI choice) for the ignorearticle if you create the List.Sort object without the ignorearticle property?


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

(2012-04-11, 19:39)bradvido88 Wrote: On another topic, regarding the JSON-RPC announcements.
Is there any way to find out what file was started when Player.OnPlay is sent? From what I've seen (in Eden Final), it does not give any indication about the file being played.

Sample announcement:
Code:
{"method":"Player.OnPlay","params":{"sender":"xbmc","data":{"title":"","player":{"speed":1,"playerid":1},"item":{"type":"movie"}}},"jsonrpc":"2.0"}
Yup you are right. If JSON-RPC notices that the currently playing item is not in the database it tries to retrieve things like title etc but it only sends out information that is not empty. It might make sense to add the "file" property if there is no database ID.

(2012-04-11, 19:39)bradvido88 Wrote: Edit:
I am using Player.GetItem to get the file for the currently playing item,which works well enough.

However, if I am playing a .strm (a playlist), is there any way to get the name of the strm/playlist instead of the currently playing file?

I couldn't seem to find a way to get the name of the currently playing playlist
I don't really know how strm files work but if they work similar to m3u files then XBMC does not remember that filename after it has loaded the actually playable files from it.

(2012-04-12, 12:27)N3MIS15 Wrote:
(2012-04-12, 12:06)Montellese Wrote: JSON-RPC doesn't allow you to change anything right now in XBMC's library/database.

I was refering to the FooLibrary.Set pull request. i built a copy of xbmc eden with those changes and I have been able to change everything but movie sets. I can only append them.
Ah right now I understand. Well the problem is that you aren't really able to do any of those things in XBMC either. XBMC itself doesn't even allow you to manually add items to a set. As long as that support is missing in XBMC itself it will most likely be missing in JSON-RPC as well.

(2012-04-12, 12:48)joethefox Wrote:
(2012-04-12, 12:06)Montellese Wrote: No JSON-RPC does not provide access to any (GUI) settings (yet).
Waiting for this, could be feasible to obtain an automatic choice (so the GUI choice) for the ignorearticle if you create the List.Sort object without the ignorearticle property?
No, JSON-RPC listing/sorting does not care about the GUI setting for irgnoring articles in sorting.



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

Thanks for the update. Hope you had a good holiday Smile


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - joethefox - 2012-04-17

If the ActivePlayer is the video player (id=1) if I make this kind of request (to open a picture)
{"method":"Player.Open","id":-111891377,"jsonrpc":"2.0","params":{"item":{"file":"/path/to/image.jpg"}}}

xbmc crash. Regardless of whether the request is correct or not, I think this should not happen.

linux xbmc version eden 11 stable compiled 7 april 2012.


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

Hi All,

In Eden (11.0), when you insert a DVD in a local optical drive, you get get a new menu item appearing on the homepage called "PLAY DISC". Selecting this starts playback of the DVD (or brings up the DVD menu system).

How can I:

a) detect a dvd has been inserted (I don't seem to get any kind of notification via JSON); and
b) how do you play said DVD?

The only way I can think to play the dvd is to allow the user to browse the "video" files via the 'Files.GetSources' request.

I suspect i'm over thinking it and there's a much simpler method?

Thanks in advance,
Matt.



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

(2012-04-17, 21:25)joethefox Wrote: If the ActivePlayer is the video player (id=1) if I make this kind of request (to open a picture)
{"method":"Player.Open","id":-111891377,"jsonrpc":"2.0","params":{"item":{"file":"/path/to/image.jpg"}}}

xbmc crash. Regardless of whether the request is correct or not, I think this should not happen.

linux xbmc version eden 11 stable compiled 7 april 2012.
Will have to try and reproduce this myself. Can you please create a bug report on trac and CC me so I won't forget? Thanks. And BTW a debug log and crash log (if available) would be nice.

(2012-04-22, 08:36)doozer Wrote: Hi All,

In Eden (11.0), when you insert a DVD in a local optical drive, you get get a new menu item appearing on the homepage called "PLAY DISC". Selecting this starts playback of the DVD (or brings up the DVD menu system).

How can I:

a) detect a dvd has been inserted (I don't seem to get any kind of notification via JSON); and
b) how do you play said DVD?

The only way I can think to play the dvd is to allow the user to browse the "video" files via the 'Files.GetSources' request.

I suspect i'm over thinking it and there's a much simpler method?

Thanks in advance,
Matt.
First of all there's no notification for when a DVD was inserted. And I also don't think that there's currently a way to play a disc. This would be possible if there would be a "dvd://" VFS path in XBMC but AFAIK there isn't.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - joethefox - 2012-04-22

(2012-04-22, 09:52)Montellese Wrote: Can you please create a bug report on trac and CC me so I won't forget? Thanks. And BTW a debug log and crash log (if available) would be nice.

done http://trac.xbmc.org/ticket/12947 . GDB Backtrace included.

EDIT: sunday morning coders rocks Wink . Thank you.

EDIT2: just tested and confirmed that the issue is solved.


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

(2012-04-22, 09:52)Montellese Wrote:
(2012-04-17, 21:25)joethefox Wrote: If the ActivePlayer is the video player (id=1) if I make this kind of request (to open a picture)
{"method":"Player.Open","id":-111891377,"jsonrpc":"2.0","params":{"item":{"file":"/path/to/image.jpg"}}}

xbmc crash. Regardless of whether the request is correct or not, I think this should not happen.

linux xbmc version eden 11 stable compiled 7 april 2012.
Will have to try and reproduce this myself. Can you please create a bug report on trac and CC me so I won't forget? Thanks. And BTW a debug log and crash log (if available) would be nice.

(2012-04-22, 08:36)doozer Wrote: Hi All,

In Eden (11.0), when you insert a DVD in a local optical drive, you get get a new menu item appearing on the homepage called "PLAY DISC". Selecting this starts playback of the DVD (or brings up the DVD menu system).

How can I:

a) detect a dvd has been inserted (I don't seem to get any kind of notification via JSON); and
b) how do you play said DVD?

The only way I can think to play the dvd is to allow the user to browse the "video" files via the 'Files.GetSources' request.

I suspect i'm over thinking it and there's a much simpler method?

Thanks in advance,
Matt.
First of all there's no notification for when a DVD was inserted. And I also don't think that there's currently a way to play a disc. This would be possible if there would be a "dvd://" VFS path in XBMC but AFAIK there isn't.

Thanks for the quick reply.

Is this something I can request for a future version?



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

(2012-04-22, 11:49)doozer Wrote: Thanks for the quick reply.

Is this something I can request for a future version?

Sure create a feature request ticket on trac and describe what you would like to be able to do.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-04-29

I want to display the stream details (codecs etc) of the currently playing file and it seems you have to use either Player.GetItem for video or Player.GetProperties for music. So:
Code:
{"jsonrpc":"2.0","id":2,"method":"Player.GetProperties","params":{ "playerid":0,"properties":["speed", "shuffled", "repeat", "subtitleenabled", "time", "totaltime", "position", "currentaudiostream"] } }
Gives me the current audio stream for music as you would expect and:
Code:
{"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "duration", "thumbnail", "file", "fanart", "streamdetails"], "playerid": 0 }, "id": 1}
gives me the stream(s) for video.

It makes sense that Player.GetItem gives me all the streams for video but doesn't make sense (to me) that I get nothing for music. It also doesn't make sense (again to me) that Player.GetProperties currentaudiosteam is empty for videos.

What I'd like to see is Player.GetProperties returning the current video as well (so a currentvideostream, a videostreams to keep it consistent with audio) and Player.GetItem streamdetails returning the audio streams of audio files.

Hopefully that makes sense. If you agree I'll create a ticket (bug or feature?).


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

Hm Player.GetProperties should work for videos as well. I just tested your example request (replaced the "playerid" though) and both "currentaudiostream" as well as "audiostreams" (which is not part of your request) work perfectly fine for me:
Code:
{
    "id" : 1,
    "jsonrpc" : "2.0",
    "result" : {
        "audiostreams" : [(2) {
                "index" : 0,
                "language" : "ger",
                "name" : "German - AC3 5.1"
            }, {
                "index" : 1,
                "language" : "eng",
                "name" : "English - AC3 5.1"
            }
        ],
        "currentaudiostream" : {
            "bitrate" : 645050,
            "channels" : 6,
            "codec" : "ac3",
            "index" : 0,
            "language" : "ger",
            "name" : "German - AC3 5.1"
        },
        "position" : 0,
        "repeat" : "off",
        "shuffled" : false,
        "speed" : 1,
        "subtitleenabled" : true,
        "time" : {
            "hours" : 0,
            "milliseconds" : 588,
            "minutes" : 9,
            "seconds" : 6
        },
        "totaltime" : {
            "hours" : 1,
            "milliseconds" : 0,
            "minutes" : 41,
            "seconds" : 55
        }
    }
}

Player.GetItem does not have any streamdetails for music because XBMC doesn't store those at all. See the details you can retrieve for songs using AudioLibrary.GetSongs. There's no "streamdetails" property or anything remotely similar.

Concerning "currentvideostream" and "videostreams": I'm not really fond of this idea because probably 99% (in my case 100%) of the videos only have a single video stream. You need to use Player.GetItem anyway to retrieve things properties like "title" etc so you can also retrieve the videostream from the "streamdetails" property. The only reason for "currentaudiostream", "audiostreams", "currentsubtitle" and "subtitles" is because the player allows to change them using Player.SetAudioStream and Player.SetSubtitle.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-04-29

Okay, you're right about Player.GetProperties. I think I must have been watching Live TV. Sorry about that, put it down to a Sunday.