XBMC Community Forum
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Development (/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (/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 12:46

that would be a nice test case Smile


- Bram77 - 2010-04-14 14:33

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 14:37

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 16:48

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


- Bram77 - 2010-04-14 17:03

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


- Bram77 - 2010-04-14 17:08

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 17: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 18:07

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 23:05

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 00:23

... 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.