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)



- Bram77 - 2010-04-14

that would be a nice test case Smile


- Bram77 - 2010-04-14

Is there a logic behind the order in which the GetActivePlayers method returns the values? I mean, can I assume the last value is the player most recently used or started?
I'm merging the VideoPlayer, AudioPlayer and PicturePlayer namespaces into one namespace because of the overlap. This makes it less work to maintain the code. So I use the GetActivePlayer method to determine the default player if no specific player has been specified. I'd like to know which player I should assume to be the one most recently addressed.


- topfs2 - 2010-04-14

Bram77 Wrote:Is there a logic behind the order in which the GetActivePlayers method returns the values? I mean, can I assume the last value is the player most recently used or started?

The logic of the order is that we first check if we are playing video or music, if so we add audio / video player. Then we check if we are playing pictures and thus add it. I'm open for better suggestions here since the first item actually can be any then, its only if there are 2 items we know first must be video / audio and second is picture.


- Bram77 - 2010-04-14

To keep it simple, maybe you could add a method that returns the most recently addressed player? ActivePlayer or so...?


- Bram77 - 2010-04-14

The SeekTime seems to use seconds, not in MS as described in introspect.


- Bram77 - 2010-04-14

I'll just keep posting unexpected behavior Smile

This...

Code:
{"jsonrpc": "2.0",  "method": "PicturePlayer.Zoom", "params": 150, "id": 1}

...returns an error....

Code:
"code" : -32602, "message" : "Invalid params."

...no matter what integer value I pass. The introspect describes the method expects a integer value. Am I missing something?


- Bram77 - 2010-04-14

There is no option to choose between right or left rotation in the XBMC PicturePlayer (not as much in the JSON api), is there?


- topfs2 - 2010-04-14

Bram77 Wrote:To keep it simple, maybe you could add a method that returns the most recently addressed player? ActivePlayer or so...?

IMO, more confusing for multiple clients.

Perhaps return { "audioplayer": true, "videoplayer": false, "pictureplayer": true } is easier to use.

Bram77 Wrote:The SeekTime seems to use seconds, not in MS as described in introspect.

Hmm, might be, cooked it up rather fast Smile

Bram77 Wrote:I'll just keep posting unexpected behavior Smile

This...

Code:
{"jsonrpc": "2.0",  "method": "PicturePlayer.Zoom", "params": 150, "id": 1}

...returns an error....

Code:
"code" : -32602, "message" : "Invalid params."

...no matter what integer value I pass. The introspect describes the method expects a integer value. Am I missing something?

integer needs to be between 1 and 9, but this isn't self explaining, a float would be more appropriate for this perhaps.

Bram77 Wrote:There is no option to choose between right or left rotation in the XBMC PicturePlayer (not as much in the JSON api), is there?

Nope, not sure it exist in core either, although I like the idea. Please a ticket for it (not jsonrpc related).


- Bram77 - 2010-04-14

The boolean responses for active/inactive players does seem more efficient as checking for the states does takes less code and they can only have two states.

The video- and music player can't ever be playing at the same time and the picture player will always be the most recently addressed if music or video is playing. Is that correct? If so, there is no need for a function that returns the most recently addressed player.


Some more questions....

- System.GetInfo returns a valid JSON response with the value 'null'. This method hasn't been completed yet in the api, or is it a bug?

- Files.GetSources seems to expect a parameter but I can't figure out what it should be.


- Bram77 - 2010-04-15

... and some suggestions for additional methods ...

- VideoPlayer.TogglePartyMode

- AudioPlayer.TogglePartyMode

- Status.GetRepeatMode
- Status.IsPartyModeEnabled
- Status.IsPlaying
- Status.IsMuteEnabled
- Status.IsVideoShuffleEnabled
- Status.IsAudioShuffleEnabled
- Status.IsLastFmEnabled
- Status.GetNowPlaying
- Status.GetNowPlayingTime
- Status.GetNowPlayingTimeMS
- Status.GetNowPlayingPercentage
- Status.GetNowPlayingAudio
- Status.GetNowPlayingVideo
- Status.GetVolume

- AudioPlayer.LastFmLove
- AudioPlayer.LastFmHate

- Controls.ToggleMute (move from the XBMC namespace)
- Controls.Stop (regardless of what type of media is playing)
- Controls.PlayPause (play/pause the currently playing media; regardless of the type of media)
- Controls.Play (start playing the current playlist; regardless of the type of media)
- Controls.SkipNext (next in playlist; regardless of the type of media)
- Controls.SkipPrevious (previous in playlist; regardless of the type of media)
- Controls.Forward (regardless of the type of media)
- Controls.Rewind (regardless of the type of media)
- Controls.SmallSkipBackward (regardless of the type of media)
- Controls.SmallSkipForward (regardless of the type of media)
- Controls.BigSkipBackward (regardless of the type of media)
- Controls.BigSkipForward (regardless of the type of media)
- Controls.SendKey (could make life a lot easier for anyone using a HTPC/Xbox without a keyboard attached)

... most of the controls overlap with the existing controls. But they could make using the api a bit easier. I've already got it covered in the JS api. Making it easier to use will hopefully move more people to developing remotes Smile

The status requests were a real b*tch in the HTTP api. They rendered a lot of overhead since I could only get the total sum of now playing. Having to obtain all the data to get the current playing percentage and filename (which are refreshed every second by default in XbmControl i.e.) made it hardly impossible to not get timeouts and lockups. So allowing to access this data individually could greatly improve speed and ease of use.

Essentially 4 values are required every few seconds/second in most cases....

- Current volume
- Current playing time/timeMS/percentage
- Some way to detect if new media is playing so all the other data can be updated (now playing info; artwork; highlighted playlist item; I use the file path for this in XbmControl since it's unique)
- Is anything playing at all? (slow down the request interval to reduce network load if not; the previous value could potentially be used for this)

... Ideally these values could be requested with ONE post.

Maybe the "XBMC.StartSildeshow" method should be in the PicturePlayer namespace?

Great to be able to post suggestions, even though I'm not expecting them to be implemented all...or any of them Smile I'm just suggesting.


- sebak - 2010-04-15

Nice stuff bram77.

Would like to help on the web interface. Maybe some people can gather for this. I started a topic about this some time ago, but it seems to have disappeared with the forum downtime.


- Tolriq - 2010-04-15

Quote:Essentially 4 values are required every few seconds/second in most cases....

- Current volume
- Current playing time/timeMS/percentage
- Some way to detect if new media is playing so all the other data can be updated (now playing info; artwork; highlighted playlist item; I use the file path for this in XbmControl since it's unique)
- Is anything playing at all? (slow down the request interval to reduce network load if not; the previous value could potentially be used for this)

I would just add the playing / paused status in this every second request Smile since there can be multiple way to control XBMC we need to have this info to update buttons accordingly Smile

Too bad there was a one month forum lost Sad lot's of things where said about new functions.

Another needed one is the system.getinfo to get os / version and logged user at minima Smile

And the seekPercent :p:p


- Bram77 - 2010-04-15

sebak Wrote:Nice stuff bram77.

Would like to help on the web interface. Maybe some people can gather for this. I started a topic about this some time ago, but it seems to have disappeared with the forum downtime.

Great idea. I have some visions of how it should function and where every should be, but I'n not a graphical designer. So maybe I'll just try to write a easily themable basic interface with all the functionalities and everyone with some graphical and HTML/CSS skills can have a go at beautifying it.


- Bram77 - 2010-04-15

Tolriq Wrote:I would just add the playing / paused status in this every second request Smile since there can be multiple way to control XBMC we need to have this info to update buttons accordingly Smile

Too bad there was a one month forum lost Sad lot's of things where said about new functions.

Another needed one is the system.getinfo to get os / version and logged user at minima Smile

And the seekPercent :p:p

With playing time/tmeMS/percentage I meant seekTime, seekTimeMS and seekPercentage.
You're right, I forgot about play/pause, that would be nice to!


- Bram77 - 2010-04-16

When playing a streamed media file the GetPercentage method returns inf which is not a string. The JSON parser crashes on this value. I could try to work around it, but I guess 0.0 would be valid value to? I don't really like to work around stuff Smile

edit:
What would be cool is a method that returns more details about the media played, like the codec used, the resolution, audio quality (bitrate), frequency, and if it's a stream or just a file i.e. There's no way to detect this these values reliably now.