XBMC Community Forum
[Linux] [RELEASE]Plugin for Timer- and Powermanagement in XBMC and TVHeadend - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: PVR Development (/forumdisplay.php?fid=136)
+--- Thread: [Linux] [RELEASE]Plugin for Timer- and Powermanagement in XBMC and TVHeadend (/showthread.php?tid=115758)

Pages: 1 2 3 4 5 6 7


- _BJ1 - 2011-12-27 12:11

Sorry fecus, I have also no idea. Anyone else here?

_BJ1


- fecus - 2011-12-27 18:04

_BJ1 Wrote:Sorry fecus, I have also no idea. Anyone else here?

_BJ1

Today everything work. I don't know why. I made two success records. Only I disable the xbmc in autorun in GUI. The xbmc didn't run. Then I set again. The shutdown.sh run without error and set the rtc.
Maybe the upgrade set autorun with other rights. I overwrite something with my user when I reset autorun. It is only theory.Rolleyes

Now I disable upgrade, except security.

Thank you everything and Happy New Year!


- _BJ1 - 2011-12-27 18:18

I'm glad that it's now working! Happy New Year!

_BJ1


- _BJ1 - 2012-01-24 23:36

Update. See first post.

_BJ1


- harryzimm - 2012-02-16 21:52

Hi

Whats the best way to add a check to see if there is a current subscription active? I also stream to my apple tv2 and would like the tvheadend server to remain on if i am steaming to my atv2. (hope this makes sense Wink)

status.xml

<currentload>
<recordings>
<recording>
<next>13</next>
</recording>
</recordings>
<subscriptions>1</subscriptions>
</currentload>

hope you can help

EDIT:

I just added this to the script and it working great so far

# Check for current subscription. If there an active 'subscription' tag,
recNodes = xmldoc.getElementsByTagName('subscriptions')
state = ''
if recNodes:
status = recNodes[0].childNodes[0].data
if status == "1":
powerOff = False
return powerOff
else:
state = 'no current subscription(s)'

extramargin = 0
if c: extramargin = int(__counter__)

I have no idea if this the correct way but it seems to be working


cheers


- _BJ1 - 2012-02-17 13:52

Hi,

<subscription> means that a recording is in progress or will scheduled in near (or far) future. If you want your server remains on if there is a subscription, you are right. But is there a subscription far away (7 days until recording) why you want your server awaken all the time? If your server supports ACPI/NVRAM-wakeup (almost boards will do that) its better to use this mechanism and wakeup the server at the right time automatically (like this plugin does).

_BJ1


RE: [RELEASE]Timer and Powermanagement for XBMC(live) and TVHeadend - _BJ1 - 2012-04-08 22:53

Release 0.1.5 from 08.04.12
- Since the range of EPG-Informations on some tv-services isn't long enough to serve the automatic recorder of tvheadend for a longer time, I've implemented a periodically wakeup in an interval between from "off" (inactive) to about 7 days. This is usefull for updating the EPG-data. For more information see post #1 in this thread.


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/XBMC-live and TVHeadend - Baswazz - 2012-04-23 20:48

Thx for this add-on, one curious point that is missing in xbmc-pvr icm tvheadend.


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/XBMC-live and TVHeadend - mastix - 2012-06-05 17:05

Hey _BJ1,

first of all... thank you very much for this nice and handy plugin. That feature was really missing.

I have a question though. After running some test, I could see that my system woke up and went back to sleep two nights before.

Yesterday, when I tried to shutdown XBMC it told me that I can't because a TV show is going to be recorded soon. That's ok. So I kept it running. This morning I saw that my system was still up and running. In the log file, I couldn't see any sign that it was trying to shut down:

I will run a new test now... Record something in the near future, so that the system tells me that it can't shut down and after the recording I'd expect the system to shut down.

Is my assumption correct?

EDIT: Looks like the shutdown worked fine this time... maybe due to the fact that I was watching it! Big Grin

05.06.2012 17:31:09: PVR Manager: Stop recording of "Some TEST"
05.06.2012 17:31:09: PVR Manager: no current recording(s)
05.06.2012 17:31:09: PVR Manager: next recording in 334 minutes
05.06.2012 17:31:09: PVR Manager: Init countdown, system will shut down in 300 secs
05.06.2012 17:36:09: PVR Manager: Wakeup for Recording by ACPI at 05.06.2012 23:00:09 (UNIX-Time: 1338930009)
05.06.2012 17:36:09: PVR Manager: Instruct the system to shut down

Greetz,

Sascha


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/XBMC-live and TVHeadend - mastix - 2012-06-05 17:18

I've also discovered something else (might be a misconfig (401 = not authorized) or a bug... I don't know):

In my tvheadend log I can see that every 20 seconds ther the following message appears:

Jun 05 17:10:27 HTTP: 127.0.0.1: /status.xml -- 401
Jun 05 17:10:27 HTTP: 127.0.0.1: /status.xml -- 401
Jun 05 17:10:27 HTTP: 127.0.0.1: /status.xml -- 401
Jun 05 17:10:27 HTTP: 127.0.0.1: /status.xml -- 401
Jun 05 17:10:47 HTTP: 127.0.0.1: /status.xml -- 401
Jun 05 17:10:47 HTTP: 127.0.0.1: /status.xml -- 401
Jun 05 17:10:47 HTTP: 127.0.0.1: /status.xml -- 401
Jun 05 17:10:47 HTTP: 127.0.0.1: /status.xml -- 401
...

When looking at the prvmanager.log, I can see that there's something going on every 20 seconds (at the same time, so I don't think that's it's coincidence... Big Grin)... in the python script I can see that this check happens every 20 seconds (CYCLE).

05.06.2012 17:10:27: PVR Manager: Service still active, monitoring PWR/OTHER: yes/no
05.06.2012 17:10:47: PVR Manager: Service still active, monitoring PWR/OTHER: yes/no
...

So it looks like this check does not work as expected as the tvheadend server would return a 401 in this case.

I've entered the correct credentials in the addon, because everything else seems to work... see the snippet from the log:

05.06.2012 08:16:03: PVR Manager: next recording in 889 minutes
05.06.2012 08:16:03: PVR Manager: Wakeup for Recording by ACPI at 05.06.2012 23:00:03 (UNIX-Time: 1338930003)
05.06.2012 08:16:03: PVR Manager: Instruct the system to shut down
05.06.2012 08:16:05: PVR Manager: service finished
05.06.2012 16:36:01: PVR Manager: no current recording(s)
05.06.2012 16:36:01: PVR Manager: next recording in 389 minutes

So is this a bug? Or do I have to enter my creds somewhere else?

OS: Ubuntu 12.04 - latest greatest version of addon

Regards,

Sascha


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/XBMC-live and TVHeadend - _BJ1 - 2012-06-05 18:40

Has XBMC full access to TVHeadend (in TVHeadend: Configuration -> Access Control -> Streaming/Video Recorder/Web Interface/Admin enabled) and Username/Password for access is set in the configuration dialog of the addon?

Code:
05.06.2012 08:16:03: PVR Manager: Instruct the system to shut down
05.06.2012 08:16:05: PVR Manager: service finished
05.06.2012 16:36:01: PVR Manager: no current recording(s)
05.06.2012 16:36:01: PVR Manager: next recording in 389 minutes

There is a time gap between 08:16 to 16:36. Was the PC really down in this gap (PVRManager should the system down)? Also, you have powered up the system at 16:36 manually but next schedule is at 23:00 o'clock. The addon 'knows' when you turn the system on and check for schedules. So there is nothing to do for the addon and it's exiting. When you press power again the addon turns back, check schedules and shut off/shut not off the system when a schedule is far away/near.

Code:
05.06.2012 17:10:47: PVR Manager: Service still active, monitoring PWR/OTHER: yes/no

That means, a recording is active and you've pressed the PWR-Button on remote but no other buttons. In this case you will be "warned" after finishing the recording (300 secs) and then the system shuts down. If you press at least a button (except power) the service will be aborted and the system keeps still running on. So if you want to go to bed the very last button must be 'power' and not 'volume down' Smile

Quote:So it looks like this check does not work as expected as the tvheadend server would return a 401 in this case.

No. If the addon can't read the status.xml (i.e. pipe broken, TVHeadend down) the addon shuts down the system immediatly because the schedule is obsolete in this case... But a side-effect is that a next timer for schedule would'nt be set (because the status.xml could'nt read at this moment). Hey - thats a new idea for a new version to avoid this case Wink

_BJ1

Btw: Are you a member from the german vdr-portal?


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/XBMC-live and TVHeadend - mastix - 2012-06-06 14:07

Hi,

thank you very much for your answer!

The gap is ok... the system was powered off at that time! Smile

I've checked both settings again... everything is fine... tvheadend access has all check marks... and the plugin has been configured correctly as well.

I can still see the 401s in my tvheadend log.

This is really easy to reproduce (I just did it again):

* Make sure XBMC and tvheadend are up and running
* Record a show that starts in about 10 minutes
* Press Power Off Button (on the remote)
** Addon will tell you that it can't shut down due to an upcoming recording (that will put the python script into the 20-seconds-loop)
* Then have a look at the tvheadend logs (in the web ui)

Every time the following message appears in the pvrmanager.log (every 20 seconds)...

Code:
05.06.2012 17:10:47: PVR Manager: Service still active, monitoring PWR/OTHER: yes/no

... the following message appears in the tvheadend log:

Code:
Jun 05 17:10:47 HTTP: 127.0.0.1: /status.xml -- 401started

Are you able to reproduce this issue?

I'm not a member of VDR portal... more like a silent reader! Big Grin

And now in German: Vielen Dank schonmal für deine Hilfe! Smile


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/XBMC-live and TVHeadend - _BJ1 - 2012-06-06 19:18

Quote:Are you able to reproduce this issue?

No, I can't reproduce. No messages shown here in the systemlog of tvheadends webinterface

Could you try:

Add a new user in tvheadend (configuration -> access control) with

username/password like settings in the addon-setup
prefix 127.0.0.1/0 (if tvheadend runs on the same machine)
access for streaming/videorecorder/webinterface/admin enabled

_BJ1


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/XBMC-live and TVHeadend - mastix - 2012-06-10 23:34

Hi,

tried it again with a new user (I've set up the addon accordingly)... no chance... Frown

It keeps displaying the 401 message... for some reason that I don't understand.

Regards,

mastix


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/XBMC-live and TVHeadend - Claudio.Meldini - 2012-06-11 13:43

Hello _BJ1, your script is fantastic!!! thank you!!!!!!!!!!!!!!!!!
my htpc is now almost perfect!!
but there is a little problem with your script:
i don't want to use "turn on for epg update" because i use htpc all days and epg update start on every boot.
but if i select 0 in update interval the script stop works, this is my error (from log):

13:23:49 T:2917137264 NOTICE: -->Python Interpreter Initialized<--
13:23:49 T:2917137264 NOTICE: PVR Manager: no current recording(s)
13:23:49 T:2917137264 NOTICE: PVR Manager: next recording in 196 minutes
13:23:49 T:2917137264 ERROR: Error Type: <type 'exceptions.ZeroDivisionError'>
13:23:49 T:2917137264 ERROR: Error Contents: integer division or modulo by zero
13:23:49 T:2917137264 ERROR: Traceback (most recent call last):
File "/home/adone/.xbmc/addons/script.program.pvrmanager/default.py", line 263, in <module>
__bSysState__ = getSysState()
File "/home/adone/.xbmc/addons/script.program.pvrmanager/default.py", line 196, in getSysState
epgTime = curTime + datetime.timedelta(days=int(curTime.strftime('%j')) % int(__epg_interval__))
ZeroDivisionError: integer division or modulo by zero

Now i set 6 days on interval, but i'd like to set 0 days, can you tell me how resolve this error?
Have you also this error if you set 0 days?
thanks in advance.