1

I have an XBMC setup that I absolutely love at home. Now, I've been doing a bunch of automation to make everything run smoothly and without manual maintenance (Like updating my library automatically on new arrivals etc.), however one thing I'm missing:

I want to write a shellscript, which takes care of suspending the machine at night, and waking it at a predefined time the next day. There's two things to it:

1) It should start up automatically at predefined intervals. I have this covered through RTC + wakealarm in Ubuntu.

2) It should, at a specific time at night, check if XBMC is currently playing anything (In case I'm up at night). If XBMC is NOT playing, it should suspend the machine. I'm unaware if this is possible ?

Jesper Rasmussen
  • 258
  • 3
  • 11
  • Would `pgrep xbmc` give you what you need? You would probably need to use `cron` or `anacron`. I can't tell how much you already have written. Can you be more specific about what you have already done and how much help you need and precisely where? – Dennis Williamson Feb 11 '11 at 01:24

1 Answers1

1

I actually found the answer to this one myself, after digging quite a lot into the new JSON RPC webservice in newer XBMC's.

The webservice now allows you to poll to see if any players are currently active (When playing a video for instance). I'm going to use those in the aforementioned script to check if I'm currently watching anything, before shutting the mediacenter down for the night :)

It's described on http://wiki.xbmc.org/index.php?title=JSON_RPC#JSONRPC.GetAnnouncementFlags

Jesper Rasmussen
  • 258
  • 3
  • 11
  • Would you mind sharing your script with the world (or, specifically, me)? I think this is a fantastic idea and I'd like to implement it on my xbmc-machine. Thanks! – PhilW Dec 07 '11 at 13:15