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)



- topfs2 - 2010-05-08

I've added quite a few of the methods requested now:
  • SeekPercentage
  • GetActivePlayers to return a map of booleans instead
  • Changed naming of directory filter in Files.GetDirectory from type -> media
  • The Add and Play calls can take directory=foo, media=bar, recursive=true
  • MusicLibrary -> AudioLibrary
  • Actually fixed so filtering based on extension works when you use media=video
  • System.GetInfoLabels. Takes a string array to given infolabels available to skinners. might change namespace for it?
  • System.GetInfoBooleans. Takes a string array to given infobools available to skinners. might change namespace for it.

This means that you can do System.GetInfoLabels(MusicPlayer.Artist) to get currently playing one instead of getting the whole playlist. Not sure if we need anything else now in regards to AudioPlayer.GetCurrentlyPlaying anymore?


- Nuka1195 - 2010-05-08

since you're eliminating httpapi eventually.

what about the recently added info, the script does now with httpapi and sql?


- topfs2 - 2010-05-08

I have added a VideoLibrary.GetRecentlyAddedMovies, if you add a end=5 on that you'll get the 5 latest movies added.


- Nuka1195 - 2010-05-08

Yes i see the video recently added, but music i don't see and last watched info i don't see.

i can do this from python, but think it would be very slow.

how about the same recentlyadded for music library.

MusicLibrary.GetRecentlyAddedSongs()
MusicLibrary.GetRecentlyAddedAlbums()
MusicLibrary.GetRecentlyAddedArtists()

and

VideoLibrary.GetLastWatchedMovie()...
(only returns the one)
or
VideoLibrary.GetRecentlyWatchedMovies()...
(where it would sort decending by watched date)


- Nuka1195 - 2010-05-08

Actually looking at the introspect again, maybe this is possible with the sortmethod? i'll have a play.


- Bram77 - 2010-05-09

Thanks for the new and improved features! Very useful Smile

There is one method I don't completely understand or is very limited. The Playlist.Swap function... does it only allow to move and item up or down in the playlist? I'm trying to implement a drag/drop element in the web interface but the current swap method does not seem be able to cope with more then two index changes.

Ideally I would want to be able to create a array that looks something like this....

var a_newPlaylistOrder = new Array();
a_newPlaylistOrder[0] = 5;
a_newPlaylistOrder[1] = 0;
a_newPlaylistOrder[2] = 1;
a_newPlaylistOrder[3] = 2;
a_newPlaylistOrder[4] = 3;
a_newPlaylistOrder[5] = 4;
a_newPlaylistOrder[6] = 6;

...convert it to json so it uses the array keys for the new positions where the values are the current item indexes. As you can see in this example I've changed the position of the sixth item to be the first item, thus moving all from the first to the fifth one position down... Swap doesn't seem to be able to handle this (if I'm not mistaking).
I hope I'm explaining my intention clear enough to understand...


- Kabooga - 2010-05-10

I agree with Bram77.

The Playlist.Swap functionality should allow the swapping of two non-contiguous entries in the playlist.

This functionality was requested a few times for the original API. I even submitted a code patch for this. For some reason or another this functionality was never accepted.

Regards,

Kabooga


- topfs2 - 2010-05-10

I agree that the functionality should be there, just not sure I like the implementation.

I would imagine most usage scenarios is that you want to just move one item to a specific position, as drag and drop in the example, so how about Playlist.Move(playlist-virtual="foo", from=5, to=0)?

I guess it could take 2 arrays aswell if one needs to do alot of altering?

Otherwise a Playlist.Sort(playlist-virtual="foo", order=[5, 0, 1, 2, 3, 4, 6]) could be used but would need some usage cases on that one.
What would happen if order=[4, 4, 1, 2] and what would happen if list is 0->6 and you do order=[6, 1, 3] and so on. If I get a good spec on that I can probably work something out Smile


- topfs2 - 2010-05-10

Nuka1195 Wrote:Yes i see the video recently added, but music i don't see and last watched info i don't see.

i can do this from python, but think it would be very slow.

how about the same recentlyadded for music library.

MusicLibrary.GetRecentlyAddedSongs()
MusicLibrary.GetRecentlyAddedAlbums()
MusicLibrary.GetRecentlyAddedArtists()

and

VideoLibrary.GetLastWatchedMovie()...
(only returns the one)
or
VideoLibrary.GetRecentlyWatchedMovies()...
(where it would sort decending by watched date)

I like the idea, will check if its possible!


- Bram77 - 2010-05-10

Quote:Otherwise a Playlist.Sort(playlist-virtual="foo", order=[5, 0, 1, 2, 3, 4, 6]) could be used but would need some usage cases on that one.
What would happen if order=[4, 4, 1, 2] and what would happen if list is 0->6 and you do order=[6, 1, 3] and so on. If I get a good spec on that I can probably work something out Smile
That's exactly what I'm aiming at Smile. But your suggestion is probably better. In the JS api it could look something like...

Code:
Xbmc.AudioPlaylist.move(i_currentlIndex, i_newIndex);
or
Code:
Xbmc.AudioPlaylist.moveItem(i_currentlIndex, i_newIndex);
or
Code:
Xbmc.AudioPlaylist.setItemIndex(i_currentlIndex, i_newIndex);
....and let the api handle the item shifting. I think the last method naming is the most accurate, although setEntryIndex might even be better.


- peprasetya - 2010-05-14

As I'm just played with the jsonRPC, on the wTouch project ( you can see it on other thread ). I have a little suggestion and based on the included web on svn, file nowplaying.html.

imho, that is quite inefficient that to get the information for current playing is used 2 method. First to get type of media use Player.GetActivePlayers, then second step get media playlist by VideoPlayList.GetItems or AudioPlayList.GetItems.
In my case with wTouch, there is third step to get current time playing.

In my opinion, as getting info of what current play may a frequent used things, how about to make it more efficient, by calling a method you can get all the info, like MediaType, File, Title/Label, Plot, Thumbnail, current Time, total time, Play/Pause Mode.

Anyway, question, how to ask the XBMC play a media file. I'm thinking to use XBMC.Play but I do not know the parameter to input the filename.


- topfs2 - 2010-05-14

peprasetya Wrote:As I'm just played with the jsonRPC, on the wTouch project ( you can see it on other thread ). I have a little suggestion and based on the included web on svn, file nowplaying.html.

imho, that is quite inefficient that to get the information for current playing is used 2 method. First to get type of media use Player.GetActivePlayers, then second step get media playlist by VideoPlayList.GetItems or AudioPlayList.GetItems.
In my case with wTouch, there is third step to get current time playing.

In my opinion, as getting info of what current play may a frequent used things, how about to make it more efficient, by calling a method you can get all the info, like MediaType, File, Title/Label, Plot, Thumbnail, current Time, total time, Play/Pause Mode.

Anyway, question, how to ask the XBMC play a media file. I'm thinking to use XBMC.Play but I do not know the parameter to input the filename.

You have System.GetInfoLabels that you can query about everything you need with afaik. It takes an array so you can query everything in one swoop. You need to get the actual playlist though on its own.

XBMC.Play can take about anything, basically you feed it one or more id's.

XBMC.Play(file="/foo/bar.mp3") is probably the one your looking for, check the music and video library stuff in poc webinterface for some more. The id's are
playlist-file
playlist-virtual
file
directory, recursive, media
artistid
albumid
movieid
episodeid


- peprasetya - 2010-05-14

topfs2 Wrote:You have System.GetInfoLabels that you can query about everything you need with afaik. It takes an array so you can query everything in one swoop. You need to get the actual playlist though on its own.

XBMC.Play can take about anything, basically you feed it one or more id's.

XBMC.Play(file="/foo/bar.mp3") is probably the one your looking for, check the music and video library stuff in poc webinterface for some more. The id's are
playlist-file
playlist-virtual
file
directory, recursive, media
artistid
albumid
movieid
episodeid

Have success with XBMC.Play "file": "/somewhre/to/file"

but System.GetInfoLabels result nothing


- Swwethip1 - 2010-05-17

i know this is still in the early stages, i tried build 30130 and i have a quick question regarding the web server accessing from a wince browser !!

WHen i access my session from the wince browser I can see the "XBMC Webinterface" home screen and click on all sections - now playing, movies, etc
but when there is something playing and i go to the "now playing" screen i can not see anything (ie: tracklist,player control,etc.)

my question is, what format is that being displayed in, java,flash?

Im currently using this custom REMOTE browser based off wince

also is there any guides yet for dev. skins.. i will be looking for 640x480 and 480x640 touch screen skins
thanks


- topfs2 - 2010-05-17

Swwethip1 Wrote:i know this is still in the early stages, i tried build 30130 and i have a quick question regarding the web server accessing from a wince browser !!

WHen i access my session from the wince browser I can see the "XBMC Webinterface" home screen and click on all sections - now playing, movies, etc
but when there is something playing and i go to the "now playing" screen i can not see anything (ie: tracklist,player control,etc.)

my question is, what format is that being displayed in, java,flash?

Im currently using this custom REMOTE browser based off wince

also is there any guides yet for dev. skins.. i will be looking for 640x480 and 480x640 touch screen skins
thanks

The interface is created using java script. The java script gather data from jsonrpc. It is more than possible to create a flash equivalent that takes the data from jsonrpc if you need that.

That being said, I am not sure that our java script follows standards as I am far from a web developer and have mostly done the interface as a proof of concept for other developers. If anyone wishes to pick up and create a better one (keep in mind that it should have low requirements still, so no flash please) this would be most appreciated.