Detecting playback in progress?
#1
Having recently switched from using a combination of MythTV and MPlayer to standalone XBMC, there is one item left I'm wondering if it's possible to do.

As well as media playback, the PC does a fair bit of content downloading. As part of the config, the downloader has a custom ksh script it runs when it's finished to check if it can switch the PC off. The previous config was simple - if mplayer (among other things) was running then don't switch off.

Is there any way of doing this or similar with XBMC?
Reply
#2
You could do a request to the built-in webserver to evaluate the boolean condition Player.IsPlaying - is that what you're after?
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
Reply
#3
jmarshall Wrote:You could do a request to the built-in webserver to evaluate the boolean condition Player.IsPlaying - is that what you're after?

Thanks very much - that'll do the job nicely - just need to wrap it up in a script Smile
Reply
#4
On the basis the python engine is fubar for now, ruling out the IsPlaying option, are there any other possibilities for this one?
Reply
#5
You can run...
Code:
wget http://192.168.1.250/xbmcCmds/xbmcHttp?command=getcurrentlyplaying -O xbmcstatus.html

...(of course replacing my xbox's IP with yours), then parse xbmcstatus.html.
Reply
#6
If it would be helpful, a very simple isplaying command could be added to the HTTPAPI.
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.
Reply
#7
getcurrentlyplaying returns something like "<html><li>[Nothing Playing]</html>" if there's nothing going on. Doesn't really seem like there's a need for a new command IMO.
Reply
#8
getcurrentlyplaying will do the job perfectly - and certainly beats the route I was taking of checking the CPU utilisation of XBMC and assuming it's playing something if above a certain threshold!

Time to go digging for the web documentation I think to see what other gems it's hiding Smile
Reply
#9
I was thinking of a very simple numeric output of 0 = no, 1 = yes, 2 = yes but paused, not even html. And its "Filename:[Nothing Playing]".

But I was looking through the commands, and "getsysteminfobyname" is what you want and that's what JMarshall was referring to. That command will evaluate any of the supported infomanager labels or booleans.

in this case, you would use "getsysteminfobyname&player.playing" but i'm not sure what will be returned. it may be "true" or "false" or "1" or "0" or "yes" or "no".

** edit **
Sorry, its just "player.playing" not "player.isplaying".

And here's a list of the label and booleans that can be fetch. It'll also accept complicated booleans conditions but I guess they probably need to be URL-encoded. (I cannot confirm its the complete list and the thumbs are not supported.)

http://wiki.xbmc.org/?title=InfoLabels
http://wiki.xbmc.org/?title=List_of_Boolean_Conditions
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.
Reply
#10
Thanks for the help and the reference to the web info. There's loads of stuff from the links XBMC gives out so I can use that to parse and present via LCD display (sorry - not a big fan of how XBMC uses the LCD display Sad ).
Reply
#11
go for it. there's tons of info available. but, if you didn't know, the lcd display is crudely skinnable via the lcd.xml file. (does the linux version even supports the lcd out of the box?)

and if you're going to this work, why not build it into xbmc?
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.
Reply
#12
The Linux port of XBMC supports LCDProc which is (AFAIK) is about as close to a standard interface as you'll get on Linux. (Or at least the most likely to have been patched to support the hardware).

I did take a look at the lcd.xml file and while it does provide a way of dumping the same information on the screen, it's just the formatting I'm not convinced about. (Having a progress bar that's bigger than the display that scrolls back and forth for example).

Short term, I know I can script it fairly quickly into the customisations I have on the box (I was already using a PERL script to drive something similar when using Myth & MPlayer to do the job now done by XBMC). Not sure if that's something that would benefit XBMC though.

Long term, I'll probably look at tweaking the LCD handling of XBMC itself though (always preferrable to simplify the overall implementation of the system) which I could drop back into the mainstream if people want it.
Reply
#13
I just installed the linux port a few days ago and have some quick questions about using the HTTPAPI. Sorry if this thread wasn't meant to answer these types of questions, but it seems like you've got it working pretty well.

When I send commands from the HTTPAPI to xbox XBMC with a browser, it works perfectly, but when I send commands to the computer with the linux port XBMC, my browser is unable to establish a connection. Are you sending commands through a browser? Do you just use the computer's IP?

I have Web Server Enabled and have tried the default Web Server Port 8080 and Port 1024. I have enabled remote events and receive events from other computers. Is there anything I need to set up before using commands from the HTTPAPI?
Reply
#14
The webserver may have been broken when alpha3 was released. It's been fixed since and a new alpha is scheduled soon.
Reply
#15
The scripts I have for interacting with the webserver use localhost:8080 as they only run on the same box - for anything else you'll need the ip.

I assume you've not got anything else listening already on port 8080 (what does
Code:
netstat -an | grep 8080
give you before and after starting XBMC?
Reply

Logout Mark Read Team Forum Stats Members Help
Detecting playback in progress?0