HTTP API: New command to request Standard settings
#1
Hi,

It's a new HTTP-API command to retrieves values of settings from "stSettings"

My first goal was to query the state of "Watchmode"

How to:
GetSTSetting(settingname)
You can provide multiple settingname separated by a ;

Ex
http://xbox/xbmcCmds/xbmcHttp?command=ge...owatchmode)

http://xbox/xbmcCmds/xbmcHttp?command=Ge...tartwindow)

List of settings

Code:
myvideowatchmode
mymusicstartwindow
videostartwindow
myvideostack
additionalsubtitledirectorychecked
httpapibroadcastport
httpapibroadcastlevel
volumelevel
dynamicrangecompressionlevel
premutevolumelevel
systemtimetotalup
mute
startvideowindowed
myvideonavflatten
myvideoplaylistshuffle
myvideoplaylistrepeat
mymusicisscanning
mymusicplaylistshuffle
mymusicplaylistrepeat
mymusicsongthumbinvis
mymusicsonginfoinvis
zoomamount
pixelratio
pictureextensions
musicextensions
videoextensions
logfolder

Ticket Link
http://trac.xbmc.org/ticket/6025

Any comments/sugestions are welcome!
Reply
#2
Couple of minor issue I see:

1) Naming could be better:- GetGuiSetting
2) Muliple setting supported .. I think it will better if it was only limited to one setting at a time...
Reply
#3
Thanks for the feedback

CrashX Wrote:Couple of minor issue I see:
1) Naming could be better:- GetGuiSetting

There is another function for Gui Settings and they aren't stored in the same way. This function address Standard Settings. Maybe "GetStandardSetting" ?!

CrashX Wrote:2) Muliple setting supported .. I think it will better if it was only limited to one setting at a time...

There is less than 30 settings, event if all are requested in the same query, it's not a big deal. Plus, it's easier for developer to make 1 query with all the settings needed. But If you have arguments why not.
Reply
#4
Can you give an example of what the output of the function GetSTSetting() is with multiple gui settings ? The reason I ask is to understand the variable openTag ?
Reply
#5
CrashX Wrote:Can you give an example of what the output of the function GetSTSetting() is with multiple gui settings ? The reason I ask is to understand the variable openTag ?

OpenTag is used as an HTML/XML node in the anwser, the default is "<li>".
The tags can be customized with another HTTP-API command:

Code:
SetResponseFormat(format; value)


More info on the wiki

Here an example of an existing multiple arguments HTTP-API command:

Code:
http://xbox/xbmcCmds/xbmcHttp?command=GetSystemInfoByName(weather.location;weather.temperature)

Result:
Code:
<html>
<li>New York, NY<li>52°F</html>

Here an example of GetSTSetting() with one argument:

Code:
http://xbox/xbmcCmds/xbmcHttp?command=getstsetting(myvideowatchmode)
Result:
Code:
<html>
<li>1</html>

Here an example of GetSTSetting() with 3 arguments:

Code:
http://xbox/xbmcCmds/xbmcHttp?command=GetSTSetting(pixelratio;myvideowatchmode;mymusicstartwindow)
Result:
Code:
<html>
<li>1.000000<li>1<li>10501</html>
Reply
#6
commited to svn

http://trac.xbmc.org/changeset/18480
Reply
#7
Nice! Thanks. More HTTP API options are always better.

Getting the cuurent "shuffle", "repeat" and "partymode" state wouldn't fit in there, would it...? That's info I can't get from the HTTP API at this point.

And why isn't there an option to have it return plain XML? It would be much easier to parse the retrieved info and allow for a bit more complex data structures. That way less queries would (or could) be needed to retrieve data. I'm sure someone will agree, hopefully a developer who could think about Smile I don't have the C++ skills to make such a addition (yet).
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
#8
Bram77 Wrote:Nice! Thanks. More HTTP API options are always better.

Getting the cuurent "shuffle", "repeat" and "partymode" state wouldn't fit in there, would it...? That's info I can't get from the HTTP API at this point.

And why isn't there an option to have it return plain XML? It would be much easier to parse the retrieved info and allow for a bit more complex data structures. That way less queries would (or could) be needed to retrieve data. I'm sure someone will agree, hopefully a developer who could think about Smile I don't have the C++ skills to make such a addition (yet).

You can use ExecBuiltIn from HTTP-API to get all the settings you say, exemple with "shuffle":
-XBMC.PlayerControl(Random) --> will toggle Shuffle State
-XBMC.PlayerControl(Randomon) --> will set shuffle on wathever the state
-XBMC.PlayerControl(Randomoff) --> will set shuffle off wathever the state

I was thinking of plain XML response, I will create a poll to see if people is interested.
Reply
#9
wiki needs to be updated with this change.
Reply
#10
CrashX Wrote:wiki needs to be updated with this change.

Please ask pike for ninja status for this.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not PM or 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
m69bv3 Wrote:You can use ExecBuiltIn from HTTP-API to get all the settings you say, exemple with "shuffle":
-XBMC.PlayerControl(Random) --> will toggle Shuffle State
-XBMC.PlayerControl(Randomon) --> will set shuffle on wathever the state
-XBMC.PlayerControl(Randomoff) --> will set shuffle off wathever the state

I was thinking of plain XML response, I will create a poll to see if people is interested.

I know how to SET the state of shuffle, repeat and partymode. But not how to GET the current state Smile

I think using XML would create a much easier way to use the HTTP API. The data could be accessed in a much more predicatable way. And every OO language has several ways of handeling XML data including exception handeling. It would realy make life easier and the quality of external applications using the API better. Accessing the databases directly would be perfect for obtaining data because of the speed improvement and higer stability, but XML is de best alternative.
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
#12
Bram77 Wrote:I know how to SET the state of shuffle, repeat and partymode. But not how to GET the current state Smile

I think using XML would create a much easier way to use the HTTP API. The data could be accessed in a much more predicatable way. And every OO language has several ways of handeling XML data including exception handeling. It would realy make life easier and the quality of external applications using the API better. Accessing the databases directly would be perfect for obtaining data because of the speed improvement and higer stability, but XML is de best alternative.

Use "GetSystemInfo" to poll state.
Ex: GetSystemInfo(392) for shuffle state.

I must agree with you on all points for xml!

You know you can already access databases audio/video trough HTTP-API?
Reply
#13
Thanks for the shuffle state tip! Didn't know I could access it that way.

Yes, I know Smile I'm using it a lot. But rendering the response page costs time. If there are a lot of results, relatively a lot of time. I'm not sure how much, but depending on my experience with web application development it takes a lot more time to render the page with results, than actually obtaining the data from the database.
Because of the time it takes to compose a page and the timeout configuration the http server uses unexpected results do occur.
Also, the webserver crashes every now and then. Reliability can be improved!

Actually...using COM objects would be perfect, but that's probably a lot harder to implement and might not be cross platform.
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
#14
Bram77 Wrote:Thanks for the shuffle state tip! Didn't know I could access it that way.

Yes, I know Smile I'm using it a lot. But rendering the response page costs time. If there are a lot of results, relatively a lot of time. I'm not sure how much, but depending on my experience with web application development it takes a lot more time to render the page with results, than actually obtaining the data from the database.
Because of the time it takes to compose a page and the timeout configuration the http server uses unexpected results do occur.
Also, the webserver crashes every now and then. Reliability can be improved!

Actually...using COM objects would be perfect, but that's probably a lot harder to implement and might not be cross platform.

Yep, sql request over HTTP-API cost time, from less than 0.3s for simple request to 3s for complicated.

The solution should be to get a direct connection to database with a server sqlite interface. But there problem with data locking and sumultaneous updates.

The solution for future is to add a way to use real SQL database rather than sqllite. This solution provide also solutions for multiple XBMC instance on the same network. But like you said it's a lot of work!

But I never experienced web server crash, any exemple how to reproduce?
Reply
#15
But using a real SQL database would be a problem on the XBOX I quess...?
It sounds like the database will be migrated to an other solution sooner or later Smile

Reproducing the crashes would be a problem. It happens every now and then. I make at least 2 request per second with XBMControl (setting the response format (= heartbeat) and obtaining now playing data), so the webserver is stressed quite a bit. And there a three computers on the network, on two of them XBMControl is runnign most of the time (my girlfriends computer and mine). So that doubles the amount of requests. Sometimes XBMControl can't connect to the webserver and I can't access the webinterface but XBMC still functions correctly. So it must be the webserver... but it happens randomly, maby once a month.
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply

Logout Mark Read Team Forum Stats Members Help
HTTP API: New command to request Standard settings0