HTTP API: New command to request Standard settings

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
m69bv3 Offline
Junior Member
Posts: 46
Joined: Nov 2008
Reputation: 0
Post: #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!
find quote
CrashX Offline
Posting Freak
Posts: 1,164
Joined: Jan 2009
Reputation: 2
Post: #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...
find quote
m69bv3 Offline
Junior Member
Posts: 46
Joined: Nov 2008
Reputation: 0
Post: #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.
find quote
CrashX Offline
Posting Freak
Posts: 1,164
Joined: Jan 2009
Reputation: 2
Post: #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 ?
(This post was last modified: 2009-03-07 00:54 by CrashX.)
find quote
m69bv3 Offline
Junior Member
Posts: 46
Joined: Nov 2008
Reputation: 0
Post: #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>
find quote
m69bv3 Offline
Junior Member
Posts: 46
Joined: Nov 2008
Reputation: 0
Post: #6
commited to svn

http://trac.xbmc.org/changeset/18480
find quote
Bram77 Offline
Skilled Python Coder
Posts: 1,373
Joined: Feb 2008
Reputation: 32
Location: Netherlands
Post: #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: widget]

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
(This post was last modified: 2009-03-13 22:34 by Bram77.)
find quote
m69bv3 Offline
Junior Member
Posts: 46
Joined: Nov 2008
Reputation: 0
Post: #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.
find quote
CrashX Offline
Posting Freak
Posts: 1,164
Joined: Jan 2009
Reputation: 2
Post: #9
wiki needs to be updated with this change.
find quote
mkortstiege Offline
Team-XBMC Developer
Posts: 2,921
Joined: Jan 2008
Reputation: 8
Location: Germany
Post: #10
CrashX Wrote:wiki needs to be updated with this change.

Please ask pike for ninja status for this.

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.
find quote
Bram77 Offline
Skilled Python Coder
Posts: 1,373
Joined: Feb 2008
Reputation: 32
Location: Netherlands
Post: #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: widget]

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
(This post was last modified: 2009-03-14 12:55 by Bram77.)
find quote
m69bv3 Offline
Junior Member
Posts: 46
Joined: Nov 2008
Reputation: 0
Post: #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?
find quote
Bram77 Offline
Skilled Python Coder
Posts: 1,373
Joined: Feb 2008
Reputation: 32
Location: Netherlands
Post: #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: widget]

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
(This post was last modified: 2009-03-14 13:27 by Bram77.)
find quote
m69bv3 Offline
Junior Member
Posts: 46
Joined: Nov 2008
Reputation: 0
Post: #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?
find quote
Bram77 Offline
Skilled Python Coder
Posts: 1,373
Joined: Feb 2008
Reputation: 32
Location: Netherlands
Post: #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: widget]

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
(This post was last modified: 2009-03-15 12:55 by Bram77.)
find quote
Post Reply