JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC

  Thread Rating:
  • 8 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Montellese Offline
Team-XBMC Developer
Posts: 3,837
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2806
You misunderstood. You need to pass the "window": "video" parameter and in addition you need to pass
Code:
"parameters": [ "videodb://2/2" ]
as another parameter telling the "video" window to open the given path in the "parameters" array.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
johnsills1 Offline
Senior Member
Posts: 150
Joined: Jan 2011
Reputation: 0
Post: #2807
macrosreg, once you get this to work, could you post the command here that you use
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,837
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2808
It should be
Code:
{ "jsonrpc": "2.0", "method": "GUI.ActivateWindow", "params": { "window": "video", "parameters": [ "videodb://2/2" ] }, "id": 1 }
for tvshows. For another (video) media type or node (e.g. movie genres etc) you need to adjust the videodb:// path. An incomplete map of these paths for video nodes can be found here: https://github.com/xbmc/xbmc/blob/master...v.cpp#L202

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
marcosreg Offline
Junior Member
Posts: 5
Joined: Oct 2012
Reputation: 0
Post: #2809
(2013-03-31 18:38)Montellese Wrote:  It should be
Code:
{ "jsonrpc": "2.0", "method": "GUI.ActivateWindow", "params": { "window": "video", "parameters": [ "videodb://2/2" ] }, "id": 1 }
for tvshows. For another (video) media type or node (e.g. movie genres etc) you need to adjust the videodb:// path. An incomplete map of these paths for video nodes can be found here: https://github.com/xbmc/xbmc/blob/master...v.cpp#L202

Dear Montellese,
I really dont know how to include the information "videodb://2/2" in the parameters field of the command.
Please note that the command you use as an example:
Code:
{ "jsonrpc": "2.0", "method": "GUI.ActivateWindow", "params": { "window": "video", "parameters": [ "videodb://2/2" ] }, "id": 1 }
doesn't work for me, the one that works is:
jsonrpc?request=%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22GUI.ActivateWin​dow%22%2C%22params%22%3A%7B%22window%22%3A%22video%22%7D%2C%22id%22%3A%221%22%7D​%7D
So I currently have in the params field: params%22%3A%7B%22
Where shoud I include the information you asked me to include "videodb://2/2" ?

regards and many thanks for your attention and time.
marcosreg
(This post was last modified: 2013-03-31 22:56 by marcosreg.)
find quote
devkid Offline
Senior Member
Posts: 197
Joined: Jul 2011
Reputation: 5
Post: #2810
(2011-12-26 11:54)Montellese Wrote:  
null_pointer Wrote:Is there any way to get the "Exclude from scan" setting for the source using the JSON-RPC Files.GetSources or any other RPC call or approach for that matter?

I just want a list of sources that should be included in the scanning for library items.

Question originally posted here:
http://forum.xbmc.org/showthread.php?tid=117595

That's not possible right now but it's a good idea. Can you create a feature request ticket for it and CC me? We could either return an additional property "excluded" for every source or we could add a parameter with which you can specify wether to provide the excluded sources as well.

(2011-12-27 05:07)null_pointer Wrote:  
Quote:That's not possible right now but it's a good idea. Can you create a feature request ticket for it and CC me? We could either return an additional property "excluded" for every source or we could add a parameter with which you can specify wether to provide the excluded sources as well.

Thanks, done.

http://trac.xbmc.org/ticket/12354
Hm, is this functionality available now? The ticket got closed with "Obsolete", so I guess it is already possible?
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,837
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2811
(2013-03-31 22:55)marcosreg Wrote:  Dear Montellese,
I really dont know how to include the information "videodb://2/2" in the parameters field of the command.
Please note that the command you use as an example:
Code:
{ "jsonrpc": "2.0", "method": "GUI.ActivateWindow", "params": { "window": "video", "parameters": [ "videodb://2/2" ] }, "id": 1 }
doesn't work for me, the one that works is:
jsonrpc?request=%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22GUI.ActivateWin​dow%22%2C%22params%22%3A%7B%22window%22%3A%22video%22%7D%2C%22id%22%3A%221%22%7D​%7D
So I currently have in the params field: params%22%3A%7B%22
Where shoud I include the information you asked me to include "videodb://2/2" ?

regards and many thanks for your attention and time.
marcosreg

You obviously need to URL encode my example for you to work as an HTTP GET request but it works for me 100% independent of the path I put in the "parameters" parameter.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
m0v1em4n Offline
Fan
Posts: 400
Joined: Aug 2011
Reputation: 0
Location: Derby UK
Post: #2812
Hi Guys,

I am using a program called HSTouch ( Homeseer ) to send command to Window XBMC Frodo but seem to be struggling with nextaudio

Is nextaudio available in the latest Frodo json-rpc? Came across a list which would suggest it is but in the script I am using is giving me an error

Being a compleat no hoper where scripts are concerned any help would be great thanks

this is the command I am sending

Code:
JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.ExecuteAction"",""params"":{""action"":""audionextlanguage""},""id"":1}"

here is the error

Code:
01/04/2013 15:42:24  - XBMC - {"error":{"code":-32601,"message":"Method not found."},"id":1,"jsonrpc":"2.0"}

Here is the full script that was created by jon00 a guy over at the homeseer forum all the command are working other than the nextaudio

Code:
Sub Main(ByVal ComStr As String)

Dim IP As String = "192.168.0.19"
Dim port As String = "8080"
Dim PlayerID As String = "1"
Dim URLStr As String = "http://" & IP & ":" & port & "/jsonrpc?request="
Dim ReplyStr As String = ""
Dim JsonStr As String = ""


Select Case ComStr.ToLower
Case "nextaudio"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.ExecuteAction"",""params"":{""action"":""audionextlanguage""},""id"":1}"
Case "rewind"
    JsonStr="{""jsonrpc"":""2.0"",""id"":1,""method"":""Player.SetSpeed"",""params"":{""playerid"":1,""speed"":""decrement""}}"
Case "fastforward"
    JsonStr="{""jsonrpc"":""2.0"",""id"":1,""method"":""Player.SetSpeed"",""params"":{""playerid"":1,""speed"":""increment""}}"
Case "updatevideo"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""VideoLibrary.Scan"",""id"":1}"
Case "quit"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Application.Quit"",""id"":1}"
Case "stop"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Player.Stop"",""params"":{""playerid"":" & PlayerID & "},""id"":1}"
Case "playpause"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Player.PlayPause"",""params"":{""playerid"":" & PlayerID & "},""id"":1}"
Case "down"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.Down"",""id"":1}"
Case "up"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.Up"",""id"":1}"
Case "home"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.Home"",""id"":1}"
Case "left"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.Left"",""id"":1}"
Case "right"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.Right"",""id"":1}"
Case "select"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.Select"",""id"":1}"
Case "info"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.Info"",""id"":1}"
Case "contextmenu"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.ContextMenu"",""id"":1}"
Case "30secforward"
    JsonStr="{""jsonrpc"":""2.0"",""id"":1,""method"":""Player.Seek"",""params"":{""playerid"":" & PlayerID & ",""value"":""smallforward""}}"
Case "30secback"
    JsonStr="{""jsonrpc"":""2.0"",""id"":1,""method"":""Player.Seek"",""params"":{""playerid"":" & PlayerID & ",""value"":""smallbackward""}}"
Case "back"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.Back"",""id"":1}"
Case "subtitlenext"
    JsonStr="{""jsonrpc"":""2.0"",""id"":1,""method"":""Player.SetSubtitle"",""params"":{""playerid"":" & PlayerID & ",""subtitle"":""next""}"
Case "subtitleoff"
    JsonStr="{""jsonrpc"":""2.0"",""id"":1,""method"":""Player.SetSubtitle"",""params"":{""playerid"":" & PlayerID & ",""subtitle"":""off""}}"
Case "subtitleon"
    JsonStr="{""jsonrpc"":""2.0"",""id"":1,""method"":""Player.SetSubtitle"",""params"":{""playerid"":" & PlayerID & ",""subtitle"":""off""}}"
Case "showosd"
    JsonStr="{""jsonrpc"":""2.0"",""method"":""Input.ShowOSD"",""id"":1}"
Case "setfullscreen"
    JsonStr="{""jsonrpc"": ""2.0"", ""method"": ""GUI.SetFullscreen"", ""params"": { ""fullscreen"": ""toggle"" }, ""id"": ""1""}"
Case "movieslist"
    JsonStr="{ ""jsonrpc"": ""2.0"", ""method"": ""GUI.ActivateWindow"", ""params"": { ""window"": ""video"", ""parameters"": [ ""MovieTitles"" ] }, ""id"": 1 }"
Case "tvlist"
    JsonStr="{""jsonrpc"": ""2.0"", ""method"": ""GUI.ActivateWindow"", ""params"": { ""window"": ""video"", ""parameters"": [ ""TvShowTitles"" ] }, ""id"": 1 }"
Case else
    hs.writelog("XBMC", "Command not recognised")
    exit sub
End select


If hs.ping(IP) = 0 Then
    URLStr = URLStr & JsonStr
    ReplyStr = hs.urlaction(URLStr,"GET","","")
    If ReplyStr <> "" Then hs.writelog("XBMC", ReplyStr)
Else
    hs.writelog("XBMC", "Cannot Send Command - Host Offline")
End If

End Sub
(This post was last modified: 2013-04-01 18:04 by m0v1em4n.)
find quote
marcosreg Offline
Junior Member
Posts: 5
Joined: Oct 2012
Reputation: 0
Post: #2813
[/quote]You obviously need to URL encode my example for you to work as an HTTP GET request but it works for me 100% independent of the path I put in the "parameters" parameter.[/quote]
Dear Montellese,
Now I am understanding what you were trying to say me.
I am using the URL Decoder/Encoder found at http://meyerweb.com/eric/tools/dencoder/
I have no previous experience in programming, but I gave a big step ahead today.
Thank you again
marcosreg
(This post was last modified: 2013-04-01 20:20 by marcosreg.)
find quote
claymic Offline
Senior Member
Posts: 126
Joined: Apr 2012
Reputation: 2
Post: #2814
(2013-04-01 20:17)marcosreg Wrote:  
Quote:You obviously need to URL encode my example for you to work as an HTTP GET request but it works for me 100% independent of the path I put in the "parameters" parameter.
Dear Montellese,
Now I am understanding what you were trying to say me.
I am using the URL Decoder/Encoder found at http://meyerweb.com/eric/tools/dencoder/
I have no previous experience in programming, but I gave a big step ahead today.
Thank you again
marcosreg
Marcos
You are using this to control the xbmc over IRule, right ?
You dont need to encode your command in a URL, you can send the JSON directly from the IRule.
To open windows you have to use something like this :
Quote:{"jsonrpc":"2.0","method":"GUI.ActivateWindow","params": {"window":"videolibray","parameters":"MusicVideos"},"id":1}
Its more simple to control the XBMC using the code without have to use use URL encode, so you can easily change the code if you need.
To control over the IRule you need to create a new Gateway Network, see the setup :
Name : give any name
IP Address : your xbmc ip
Port : 9090
Put the username and password if you have.
Works here for IRule and CommandFusion, so, will work for you too.
Anyway, ask Wanilton my username in the Google+, we can help you using Hangout, its more easy to show how works.
Clayton[/code]
(This post was last modified: 2013-04-01 21:26 by claymic.)
find quote
marcosreg Offline
Junior Member
Posts: 5
Joined: Oct 2012
Reputation: 0
Post: #2815
Thank you both, Montellese and Claymic,
everything is OK now.
I was abble to create commands for:
MovieTitles, MovieGenres, MovieActors, MovieDirectors, RecentlyAddedMovies, TvShowTitles, RecentlyAdded Episodes, MusicVideoTitles, MusicVideo Artists.
using a Nexus7, iRule and XBMC Gotham.
Regards
marcosreg
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,798
Joined: Nov 2011
Reputation: 49
Location: Nantes - France
Post: #2816
When requesting TVShows episodes, is it possible to get Seasons artwork ?

For now, getting Art from VideoLibrary.GetEpisodes :

Code:
_json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": { "tvshowid": %s, "properties": ["art"] }, "id": 1}' %(_file['id']))

will return the list of episodes for the show and art will be populated with TVShow artworks (tvshow.poster, tvshow.fanart, tvshow.banner, ...) and episode artworks (thumbnail, ...)

Does it cost to much time to return season artwork related to each episode.

For example, to get art(season.poster) S01E01 episode for Dexter.

Thanks.

Sorry for my english, but, you know, I'm French so ...

find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,837
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2817
Version 6.2.0

April 4th 2013:
Commit: 408ceb032934b3148586500cc3ffd34169118fea
jsonrpc: add support for resume in VideoLibrary.SetFooDetails

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
rdehouss Offline
Junior Member
Posts: 1
Joined: Apr 2013
Reputation: 0
Location: Belgium
Post: #2818
Hello Smile

I'm a new user of the JSON-RPC api, using WebSocket and it rocks! Big Grin I love it.
Thanks a lot for this!

I was wondering the status of this http://trac.xbmc.org/ticket/11990
I'm using the latest XBMC 12.1 and as far as I tried, it is not implemented, neither documented in http://wiki.xbmc.org/index.php?title=JSO...aylist.Add
If it has not yet been handled in the forum, then, I will do it, otherwise, sorry Smile
Indeed, this recursive option would be handy because, now, using the API, to add an entire folder (and subfolders) to a playlist, we have to recursively browse the directory and append each directory to the playlist.
Which, due to network, code, etc. is quite long, while, if it would be done on the server itself, it would go a lot faster.

WDYT?

Thanks a lot for your attention.

Best regards,

Raphaƫl
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,837
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2819
Nothing has been done in that direction so far.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Tolriq Offline
Donor
Posts: 2,370
Joined: Jun 2009
Reputation: 69
Location: France
Post: #2820
I'll look into this one since I need it too Tongue

I'd also like to add a Playlist.Move to simplify users that want to reorder playlist. Should I do 2 PR ?

Yatse 2 : Media Center Remote Control for Touch Screens
Yatse, the Xbmc Remote and Widgets for Android
find quote
Post Reply