The demise of HTTP API...
#1
With the remove of the HTTP API, I was wondering if there is/will be a JSON Method(or even a built in addon method) for the following:

Reading/Setting GUI Settings

In Cinema Experience, I use the HTTP API to change settings: Enable/Disable the screensaver and Enable/Disable the Auto Refresh option.


I thought this list was going to be a lot longer.. Goes to show how much the JSON RPC API already does...

Reply
#2
The reading and setting of GUI settings (from json-rpc and from addons) has been discussed at devcon and unfortunately it's anything but easy to support it properly. The way it is done in the HTTP-API is anything but clean and can have very odd behaviours as a result if a setting is changed in the wrong moment (i.e. when actually being in the settings dialog and looking at that setting). One of the problems that can arise is when you e.g. are in the service settings and the webserver setting is disabled. While you are in that screen, some addon or json-rpc client enables the webserver setting but with the current implementation the webserver won't be automatically started when the setting is not changed from within the GUI. Furthermore the setting you see on screen is not updated either so it still shows as disabled. If you then toggle the state it will go back to disabled but the GUI toggles the state of the setting on screen and you see it as enabled.

The problem is the way the settings are bound to the GUI and only meant to be changed there. In most cases it would work fine to change it from outside but in some cases it will result in utter confusion.

Why do you need to enable/disable the screensaver from your script? And why do you need to change the auto refresh option?

In general I'm no fan of any addon/script automatically messing with my settings without me knowing about it. This is fine if e.g. a remote client provides a way to change the settings from the remote itself and I have to manually do it but something else doing it automatically is something I wouldn't want in my installation. I've seen that there's an addon out there that actually toggles the "remote control" setting which some users may have disabled intentionally.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
I have some simple scripts that I use to toggle settings that are mapped to remote control buttons and they use HTTPAPI to accomplish this. For example, I have a remote control button that toggles the Shutdown function timer on/off so I don't have to manually navigate through the GUI to change this setting. I would certainly like to see this capability (to get and set settings) supported in JSON-RPC.
Reply
#4
(2012-10-05, 21:20)Montellese Wrote: The reading and setting of GUI settings (from json-rpc and from addons) has been discussed at devcon and unfortunately it's anything but easy to support it properly. The way it is done in the HTTP-API is anything but clean and can have very odd behaviours as a result if a setting is changed in the wrong moment (i.e. when actually being in the settings dialog and looking at that setting). One of the problems that can arise is when you e.g. are in the service settings and the webserver setting is disabled. While you are in that screen, some addon or json-rpc client enables the webserver setting but with the current implementation the webserver won't be automatically started when the setting is not changed from within the GUI. Furthermore the setting you see on screen is not updated either so it still shows as disabled. If you then toggle the state it will go back to disabled but the GUI toggles the state of the setting on screen and you see it as enabled.

The problem is the way the settings are bound to the GUI and only meant to be changed there. In most cases it would work fine to change it from outside but in some cases it will result in utter confusion.
I figured as much.
Quote:Why do you need to enable/disable the screensaver from your script? And why do you need to change the auto refresh option?
Screensaver - The script displays a trivia slide show for upto 60 min's. Often users have set the screen saver to come on well before that(Mine is set to 10mins for example) Being able to disable the screensaver stops XBMC from interupting the slideshow. The script first checks to see what mode the screensaver is set to, copies it, then disables it. When the script comes to an end it restores the screensaver to it's former glory. It is also wrapped in error checking code so if the script fails it also returns the setting back, no protection against XBMC hanging or crashing.

Auto Refresh
The scripts builds a playlist of videos that surround a selected Movie(gives the feel of being at a movie theatre) The videos that are available are often at different refresh rates. If the user has the auto refresh setting on, this introduces interuptions to the flow of the playlist. Disabling the refresh during everything else other than the Movie(what we are really here for) smooths out the flow. This option is controllable by the user via addon settings.
Quote:In general I'm no fan of any addon/script automatically messing with my settings without me knowing about it. This is fine if e.g. a remote client provides a way to change the settings from the remote itself and I have to manually do it but something else doing it automatically is something I wouldn't want in my installation. I've seen that there's an addon out there that actually toggles the "remote control" setting which some users may have disabled intentionally.
I agree as well regarding not liking addons messing around with settings. Having a method to temporally disabling them, with out affecting the saved settings would be nice.. Smile

Reply
#5
so using a bash script and wget to update my video library whenever utorrent adds new shows isnt a valid option anymore? that stinks
e.g.

UPDATESTRING="/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video,$SOURCE))"
Reply
#6
You can use JSON-RPC. There's a VideoLibrary.Scan method (and yes it can also take a path to a source) and since a few days you can send JSON-RPC requests over HTTP GET. Check the wiki pages on JSON-RPC (v5) for more information.

PS: It's always easy to just complain. Please try to look for a solution before coming here complaining.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#7
it wasnt like i wasnt willing to look, i had to look the write the script, jesus. Yeah i saw something about http get i think that was on the main json-rrpc page the v5 just shows a bunch of syntax that looks a lot more complicated then the http api maybe im going about it wrong for now i just reverted the commits til i find a solution
would it just be something like this http://<your-ip>:<your-port>/jsonrpc?request=VideoLibrary.Scan

or is that way to simple one would think not. i dont get how to translate the big long "schema" on the json-rpc v5 page to that
Reply
#8
You need to put together the JSON-RPC request
Code:
{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": { "directory": "<path-to-the-source>" } }
and URL-encode it. Then you pass that to the "request" HTTP GET parameter i.e.
Code:
http://<ip>:<port>/jsonrpc?request=<url-encoded-request>
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#9
what does URL encode mean? like parse it to conform with url standards?
Reply
#10
http://lmgtfy.com/?q=url+encode
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#11
this isnt right is it?

http://192.168.1.40:8080/jsonrpc?request...22+%7D+%7D
Reply
#12
(2012-10-11, 00:35)Hack_kid Wrote: this isnt right is it?

http://192.168.1.40:8080/jsonrpc?request...22+%7D+%7D

Try and learn
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#13
edit how about this it all looks cryptic to me and i dont know how to test it i put it in the browser and sent it but i dont get any response back no error though but nothing pops up on xbmc like its scanning i'll see with wget returns

http://192.168.1.40:8080/jsonrpc?request...0%7D%20%7D

i'm trying....
this seems to start the scanner now just to update my script to include the changes

thank you so much for your help please dont stop watching this thread as i might run into a few kinks but thanks for stopping to help it means a lot

wget http://192.168.1.40:8080/jsonrpc?request...0%7D%20%7D
Reply
#14
PS what about to pupop a notification box? it has support for that right?
looking at the wiki, how did you come about with this information?

{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": { "directory": "<path-to-the-source>" } }

do i have to just change the method section to GUI.SetNotification or whatever it is then add the pararms to the params secion or more to it then that
Reply
#15
this is the best ive come up with but no go

{ "jsonrpc": "2.0", "method": "GUI.ShowNotification", "params": { "string": "Auto+Library+Updater", "message": "Auto+Library+Updater" } }
nvm typeo string was suppose to be title
Reply

Logout Mark Read Team Forum Stats Members Help
The demise of HTTP API...0