开发者

Detecting if XBMC is playing, from shellscript?

开发者 https://www.devze.com 2023-02-09 16:18 出处:网络
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

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 unawar开发者_运维知识库e if this is possible ?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号