Addon to wakeup and shutdown/suspend XBMC when using TVHeadend
#16
oh, that sounds cool actually. Big Grin

But what about automatic suspends from XBMC after X mins of inactivity. You can set it in XBMC System Settings by Shutdown function timer. I haven't played with it in PVR version yet, but I guess if there is user inactivity and no recording is at that moment running or due in XX mins it suspends computer automatically. So what would one want is to run this addon when automatic shutdown timer occurs and add RTC timer for next recording wake up.

Would that be possible?
Reply
#17
I haven't used the shutdown timer feature built into XBMC before (I have seen it, but never used it) and from what I can tell of the addon, it doesn't interact with that at this point in time.

While I haven't checked, I very much doubt if the built in shutdown timer is "recording-aware" in the PVR builds. What would be cool like you said, is if the built in timer could call this addon instead of shutting down - then the RTC timer could be set and recording checked for first.

At this stage, I've never looked into how the built in shutdown timer works or how the timeout period before shutdown is recorded/configured, so I'm not sure that it would even be possible. It's a bit beyond me at this stage...

For now, I just want to work out how to retrieve the pre and post-recording padding values from tvheadend to use in setting suspend and RTC alarm wakeup times (these are currently hard coded in the script). Right now it's baby steps for me...

Nathan (nmcaullay), the addon author might be able to advise if what you're after is possible...
Reply
#18
played with the updated version and it's working great!Cool

I'm gonna check later if it's possible to include it in shutdown timer function process.

That 4h wakeup timer if there is no recording scheduled is useful for something?
Reply
#19
Great that theres now 3 of us in the world doing this!

1. I'll update the google code with the patched version. I've not tried it yet, but sounds like it works great

2. I don't know much about the xbmc shutdown timer stuff, but theres every chance it would work. It would be great if this sort of functionality could be worked into the PVR branch. If there was the option to run a script/addon when the idle timer goes off, then a script like the one in this thread could be modified to do the wakeup/shutdown/recording checks before suspending the machine. It would be a more mainline xbmc enhancement, which would be good for the product i think. Might need to do some more digging.

3. I have put a "feature" request in to tvheadend to update status.xml to reflect the offsets specified in the recording profiles. No news on when this would be done, i guess the tvheadend owner will look at it when he has time. Unless anyone here has c++ skills?
http://www.lonelycoder.com/redmine/issues/351

4. The addon is only run when you press the "power-off" button on your remote, so it will not interupt watching movies/music etc. I think the more elegant long term solution is to integrate into the idle-time thing (mentioend earlier), but i'm not sure the hooks exist in the idle shutdown part to call a script, i think it just suspends the pc.

5. The 4hr wakeup was in the case of no recordings upcoming in the PVR (would be a very odd situation), the system would wakeup and let tvheadend regather the EIT information to hopefully pickup some EPG, and some auto recordings, before setting the wakeup for the newly found recordings.

I'm happy that people are getting some mileage out of this, as while the solution is not elegant, it works, and could work for a proof-of-concept for a more mainline xbmc solution (if any PVR developers are listening).

Cheers,

Nathan
Reply
#20
Yup, i definitely think something like this should be included in pvr version in future Smile

Thanks for explaining that 4hr timer, does it work if you have tvheadend backend on same system as frontend? Is there enough time after the system is woken up for tvheadend backend epg update then xbmc pvr epg update before system is shutted down for another 4h again? Or does this work only if you have 24/7 running tvheadend backend on separate system?

Just one more question, how should this script behave if you lose network connection / backend on different pc is unreachable?

Happened to me yesterday, shutdown script was determining recording status but there was no following step in the process. I would like to suspend the system when tvheadend is unreachable for XX seconds after being checked for recording). Is it possible somehow?

EDIT: Not sure if what I wrote has much of sense, because if you are running backend on different computer, you don't have to care about xbmc suspend or wake up. The backend will be running and take cares of recording and you can do whatever you want with xbmc pvr frontend. Is that right? I'm little bit confused now Wink

The thing is I'm running both on same system (xbmc + tvheadend) but I use http proxy in xbmc which is active also for addons, but script somehow doesn't work if I set 127.0.0.1 or localhost in script.pvruptime settings, I had to set lan ip to connect to tvheadend, but when proxy is unavailable (happens sometimes) the script won't connect to tvheadend status. Well I'll have to do some more digging where the problem is. Maybe it's not related to http proxy, and it's just wrong access settings in tvheadend. Do you have to allow access from 127.0.0.1 there, or should that be working automatically out of box?
Reply
#21
hi ezechiel1917,

Yeah, I was a bit confused with your last post about having xbmc and tvheadend on separate machines - you wouldn't really be worried what your xbmc frontend is doing if the tvheadend backend was on a different machine.

Long term I may move my tvheadend backend to run on my NAS, and modifying the script to do the same wakeup/suspend on the NAS for recording TV would be handy... for now, it works a treat with a combined frontend/backend though.

With your issue regarding the proxy sometimes not resolving, maybe try adding a specific entry for the xbmc user in the tvheadend web gui for user access (Configuration > Access Control tabs) and give it access to everything:
Image).
If you're running xbmc live, the default admin user for tvheadend will be xbmc anyway, but I remember having one or two permission issues in the past, and specifically adding xbmc to the access control tab in tvheadend, with full access to admin, web interface etc solved the problem.

Then maybe referencing 127.0.0.1 again as the address for status.xml will work instead of going via the proxy?

Cheers,
Adam.
Reply
#22
Hi All, I recently upgraded tvheadend to a newer git version, and the wakeup parsing stopped working. I think they changed the subscription in status.xml. Anyway, I have updated the code and it works for me. I took some of what ads_german put in the pastebin, so please give it a go if you like. The new code is at the googlecode site, and is called default2.py
Reply
#23
Great work!

I have not myself used code.google, but could you make your files available through the svn in code.google (in the source section). This will also help you in the development of the code/add-on as changes are backed up with comments...
Reply
#24
i'd love to, but i only have about 2 minutes a day to look at this stuff... when i get more than 2 minutes, i would certainly be looking to get the svn stuff working, but i dont have the skills/time at the moment. The files are out there, so thats as good as I can do at the moment. Hope that helps Nathan
Reply

Logout Mark Read Team Forum Stats Members Help
Addon to wakeup and shutdown/suspend XBMC when using TVHeadend0