PowerShedule does not suspend after WebEPG grab (1 Viewer)

gloomyandy

MP Donator
  • Premium Supporter
  • September 15, 2006
    424
    14
    63
    Home Country
    United Kingdom United Kingdom
    MediaPortal Version: SVN Build 12451 (31.12.2006 / 17:55 CET)
    MediaPortal Skin: Blue Two
    Windows Version: XP Home SP2
    CPU Type: AMD 64X2 4200+
    HDD: Samsung 200Gb
    Memory: 1Gb DDR
    Motherboard: ASUS P1-AH1
    Motherboard Chipset: nVidia MCP 51
    Motherboard Bios:
    Video Card: nVidia GeForce 6150
    Video Card Driver: 91.47
    Sound Card: Realtek high def
    Sound Card AC3: no AC3
    Sound Card Driver: 5.10.0.5296
    1. TV Card: Hauppauge HVR-1300
    1. TV Card Type: DVB-T/Analogue hybrid with mpeg hw encoder
    1. TV Card Driver: 2.5e
    2. TV Card: Hauppauge Nova T-Stick
    2. TV Card Type: DVB-T
    2. TV Card Driver: 2.5e
    3. TV Card:
    3. TV Card Type:
    3. TV Card Driver:
    4. TV Card:
    4. TV Card Type:
    4. TV Card Driver:
    MPEG2 Video Codec: Intervideo XPack 2.11.15
    MPEG2 Audio Codec: Intervideo XPack 2.11.15
    Satelite/CableTV Provider: NTL
    HTPC Case: ASUS Pundit P1
    Cooling:
    Power Supply:
    Remote: MS MCE
    TV: Hyundai Q320 32" LCD
    TV - HTPC Connection: DVI



    The latest changes to PowerSchedule seem to have created a problem after a WebEPG grab. To see this problem you may need to ensure that the ShutdownInterval is longer than it takes for the WebEPG grab and import takes to execute. In my case 5 minutes seems long enough.

    To reproduce:
    1. Enable WebEPG grab and shedule for later today.
    2. Enable powerSchedule and set to suspend. Set the ShutDownInterval to be reasonably long (must be longer than the WebEPG plus grab takes to execute).
    3. Start MP
    4. Allow to suspend.
    5. MP will wakeup to process the WebEPG grab.
    6. MP Will not suspend after the grab has completed.

    I think this bug may be closely related to the problems reported at the end of:
    https://forum.team-mediaportal.com/showthread.php?t=14255

    But since that thread is currently marked as fixed I thought I should start a new one. Also this case is I think slightly different....


    I think this may be caused by the call to OnActivateWindow being ommented out in the code below. The call to ResetShutDown has cleared the Shutdown time and there is now nothing to re-enable it. Note though that if you remove the call to ResetShutDown you will need to be very careful to ensure that CheckNextRecording() does not select "old" programs that have a start time in the past because in some circumstances _shutDownTime can be less than DateTime.Now i.e. in the past!
    Code:
    231       if ((_wakeupTime < DateTime.Now) ||
      232            ((_rescanTVDatabase) && (!TVDatabase.SupressEvents)))
      233       {
      234 				ResetShutDown();                                  // ensure that the assumptions about EarliestStartTime are true.
      235 				CheckNextRecoring();                              // checks when the next recording takes place
      236  //       SetWakeUpTime();                                  // set the WakeUp Timer
      237         _rescanTVDatabase = false;
      238  //				OnActivateWindow(GUIWindowManager.ActiveWindow);  // SetShutDown is called when needed
      239       }

    Hope this makes some sense....

    Andy
     

    gloomyandy

    MP Donator
  • Premium Supporter
  • September 15, 2006
    424
    14
    63
    Home Country
    United Kingdom United Kingdom
    I've just been looking over my notes on the problems I saw earlier in this area and they may be of some use....

    Looking at the code the SetWakeupTime function is basically making the assumption that MP will continue to run until at least the time returned by the EarliestStartTime method. However this may not always be the case. It is possible for _shutdownTime to be earlier than this (in fact in some cases _shutdownTime can be in the past). If SetWakeupTime is ever called under these conditions and there is an event that is sooner than EarliestStartTime then this event will be missed (because no wakeup timer will be set and mp will shutdown before EarliestStartTime).

    Also...

    The code in CheckNextRecording can select an old recording or one that has an start time that will be ignored (i.e. one that is earlier then EarliestStartTime). In both cases this can be caused by the value in _shutDownTime being earlier then EarliestStartTime. If this happens the incorrectly selected program will mask later programs an several recordings can be missed.


    I hope that the above information is of some use. I don't have a fix for the current problems but I suspect that any fix will have to take the above problems into account or old problems will be re-introduced! Hope you don't mind me posting the above, not trying to "teach my grandmother to suck eggs!", just thought it may help....

    Andy
     

    gloomyandy

    MP Donator
  • Premium Supporter
  • September 15, 2006
    424
    14
    63
    Home Country
    United Kingdom United Kingdom
    Good Luck! Let me know if I can help at all!

    Andy
     

    ronilse

    Retired Team Member
  • Premium Supporter
  • July 19, 2005
    4,422
    283
    Moss
    Home Country
    Norway Norway
    Hi,
    gloomyandy, just tested a private build of revision 12465 & MP wakes fine up to grab WebEPG & hibernates after it's finished. It would be fine if you could test the same with SVN from 12465 & above.

    I didn't test WebEPG before Bavarian fixed the other issue in 12465 (so it could have been fine here all the time), but your case can be different then mine.

    Regards
    Roy
     

    gloomyandy

    MP Donator
  • Premium Supporter
  • September 15, 2006
    424
    14
    63
    Home Country
    United Kingdom United Kingdom
    Hi Ron/Bavarian,
    Just had a look at the check in and I think it will fix the problem I've reported. I will download and test as soon as I can. My system is in use at the moment and I'm not brave enough to interrupt!

    Andy
     

    gloomyandy

    MP Donator
  • Premium Supporter
  • September 15, 2006
    424
    14
    63
    Home Country
    United Kingdom United Kingdom
    Guys I've just been looking at my log files and I think I may have seen another problem. Basically what happens is this....
    1. Mp is running program "A" starts at say 17:11 program B 19:30 time is 16:30
    2. In PowerScheduler the _wakeupTime is set to 17:11
    3. MP is not in home screen so does not suspend.
    4. Time gets to shortly before 17:11 such that EarliestStartTime beomes > 17:11
    5. On the next Timer event SetWakeUpTime is called. But beause EarliestStartTime is now > _nextRecordingTime there appears to be no recording scheduled. So _wakeupTime is set (in my case) to the next WebEPG grab rather than 19:30.
    6. The 17:11 program is recorded and completes.
    7. If the user now goes to home the system will suspend. But it will not wakeup for the 19:30 recording.

    What is happening is that because SetWakeUpTime is now being called all of the time then the condition (_wakeupTime < DateTime.Now) in the code below

    Code:
    231       if ((_wakeupTime < DateTime.Now) ||
      232            ((_rescanTVDatabase) && (!TVDatabase.SupressEvents)))
      233       {
      234 				ResetShutDown();                                  // ensure that the assumptions about EarliestStartTime are true.
      235 				CheckNextRecoring();                              // checks when the next recording takes place
      236  //       SetWakeUpTime();                                  // set the WakeUp Timer
      237         _rescanTVDatabase = false;
      238  				OnActivateWindow(GUIWindowManager.ActiveWindow);  // SetShutDown is called when needed
      239       }

    never becomes true (because _wakeupTime is changed by SetWakeupTime - see above). This means that CheckNextRecording does not get called and so the 19:30 program is missed....

    Hope this makes some sense.....

    Andy
     

    Bavarian

    Retired Team Member
  • Premium Supporter
  • April 4, 2005
    698
    167
    Germany, Bayern
    Home Country
    Germany Germany
    Hi Andy,

    this makes sense. Thx for this intensive testing.
    Will implement a fix in the next few days.

    :D

    Bavarian
     

    gloomyandy

    MP Donator
  • Premium Supporter
  • September 15, 2006
    424
    14
    63
    Home Country
    United Kingdom United Kingdom
    Glad to help.....

    Andy
     

    Users who are viewing this thread

    Top Bottom