Schedule currently running program starts too late (1 Viewer)

El Gitto

Portal Member
November 4, 2006
Netherlands Netherlands
TV-Server Version: 1.0.1
MediaPortal Version: 1.0.1
MediaPortal Skin: Blue3wide
Windows Version: Vista SP1
CPU Type: Intel P4 3Ghz
Memory: 2GB DDR2
Motherboard: Intel
Video Card: MSI Radeon X300
Video Card Driver:
Sound Card: Onboard HD audio
Sound Card AC3:
Sound Card Driver:
1. TV Card: FloppyDTV
1. TV Card Type: DVB-C
1. TV Card Driver:
2. TV Card: FloppyDTV
2. TV Card Type: DVB-C
2. TV Card Driver:
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:
MPEG2 Audio Codec: Vista default
h.264 Video Codec:
Satelite/CableTV Provider:
HTPC Case:
Power Supply:
TV - HTPC Connection:

When I schedule a TV program that is currently running, sometimes the recording starts too late. I believe the recording should start immediately. Description:
1) Go the the TV guide;
2) Right click on a current running program;
3) Select "3 Record" in the popup window;
4) Select "Record" on the top left;

In the attached logs, the recording started after one minute, but the gap has been more than 10 minutes at several occasions. Here's a log entry where the gap was 2.5 minutes:

MP log:
2009-04-19 14:57:08.797967 [Debug][MPMain]: Window: TvPlugin.TVProgramInfo init
2009-04-19 14:57:10.558967 [Debug][MPMain]: TVProgammInfo.OnRecordProgram - programm = InFocus(ID:0) on 138 19-4-2009 14:25:00 - 19-4-2009 15:00:00
2009-04-19 14:57:10.570967 [Debug][MPMain]: TVProgramInfo.CreateProgram: program = InFocus(ID:0) on 138 19-4-2009 14:25:00 - 19-4-2009 15:00:00
2009-04-19 14:57:10.571967 [Debug][MPMain]: TVProgramInfo.CreateProgram - no series schedule
2009-04-19 14:57:10.651967 [Debug][MPMain]: TVProgramInfo.CreateProgram - conflicts.Count = 0
2009-04-19 14:57:10.651967 [Debug][MPMain]: TVProgramInfo.CreateProgram - create schedule = InFocus on 138 19-4-2009 14:25:00 - 19-4-2009 15:00:00  ID=0

TV-server log:
2009-04-19 14:59:28.226967 [Scheduler timer]: Recording InFocus  added in _recordingsInProgressList
2009-04-19 14:59:28.228967 [Scheduler timer]: Scheduler : time to record TvDatabase.Channel 19-4-2009 14:59:28-19-4-2009 15:00:00 InFocus
Like I said, the recording should start right away and this should be handled by the TV-server, not the client. After the OnNewSchedule() function has been called, the TV-server should check if it should start recording.

Thanks for looking into this. I think the new tv server is working great, and very reliable, except for this one issue.


El Gitto

Portal Member
November 4, 2006
Netherlands Netherlands
OK, there doesn't seem to be much interest in this bug, so I decided to debug the tvserver myself. And I found out there's a problem in the coding that gets the schedules from the database. It's in scheduler.cs, method DoSchedule(). This executes the following line: IList<Schedule> schedules = Schedule.ListAll();
For my testing I add a schedule using the tv client and I check the database table "schedule" using MySQL Query Browser and I see the record is there. But the Schedule.ListAll() returns an empty IList. It can take several minutes for this to change (the check is done every 15 seconds).
Could this be some kind of cashing error of the database? Btw, the MS SQL has the same problem.

I hope I've interested a developer to take a look at this. This issue isn't solved in release 1.0.2.



Retired Team Member
  • Premium Supporter
  • December 26, 2004
    Austria Austria
    I have seen this "issue" myselfe on the live system that it can take several minutes until the recording of an in-progress tv-show starts.

    will add that to mantis. :)



    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    Greece Greece
    Country flag

    I think El, Gitto is right. It is a caching issue. The caching is done by the Gentle framework.
    I took a quick look at the code of TvServer and TvPlugin. Cacheing is enabled in TvServer so Schedule.ListAll() will return cached data. Normally this is not a problem because when Schedule objects are persisted in TvServer, the framework automatically invalidates the cache.

    But when a new schedule is created in TvPlugin, TvPlugin.TVProgramInfo.CreateProgram(...) uses it own instance of the Gentle framework to insert the new schedule in the database. The Gentle framework in TvServer does not invalidate its cache because it is unaware of the new schedule. CreateProgram(...) in TvPlugin also calls server.OnNewSchedule() which in turn calls TvService.TVController.OnNewSchedule() on the TvServer which in turn resets the scheduler timer but does not clear the Gentle cache.

    I think the following change in TvController would fix the problem:
       public void OnNewSchedule()
            if (_scheduler != null)
            Fire(this, new TvServerEventArgs(TvServerEventType.ScheduledAdded));
          } catch (Exception ex)
    I'm going to try it tonight when I get home.



    El Gitto

    Portal Member
    November 4, 2006
    Netherlands Netherlands
    This is great news, guys. Thanks for your help. I just tested Arion's suggestion and this seems to work fine.



    Retired Team Member
  • Premium Supporter
  • October 31, 2006
    Germany Germany
    Country flag
    Thanks arion_p, that is a very nice solution for this bug.
    Just uploaded the changes to SVN.


    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    P Scheduling conflicts General 2
    D Does Schedules Direct work with mp 1.24? General Support 3
    D Trying to get mp 1.24 to recognise Schedules Direct. General Support 4
    P MP2: US user, OTA - can NOT get SchedulesDirect plugin to work on MP1 or MP2 --> how do I get OTA schedule? General 5
    G Q about scheduling weekly series when epg lists duplicate back to back episodes each week General Support 2
    T TV Recording Schedule General 2
    J Understanding what EPG shows about schedules General 8
    D Please help with getting Schedules Direct to work Newcomers Forum 10
    D How to switch versions of Schedules Direct Newcomers Forum 2
    D I just installed MP 1.23. Which version of Schedules Direct should I use, where do I obtain it from Newcomers Forum 6
    M Guide mapping schedules direct, tvguide, epg buddy How to get correct entry to the correct channel? Electronic Program Guide 0
    P EPG Schedule hours off TV-Server 0
    L Mediaportal 1.21 and Windows 10: user schedules de-activated when powerscheduler plugin is selected General Support 1
    D Media Portal wake schedule General Support 29
    joecrow Scheduled Recordings Failed (MP 1.22) General Support 12
    Lehmden Manual schedule: Possibility to enter a show name Feature Requests 1
    Lehmden [fixed] [MP2-810] Manual schedules recordings not shown in schedule list 2.2 Archive 11
    N [Finished] MP2-803 - Delete full series doesn't work when viewing a program in the extended schedule screen MediaPortal 2 12
    Jean R. How to schedule a recording based on date/time instead of EPG Newcomers Forum 2
    G How to access Scheduled Recordings without going through TV Home screen General Support 3
    R [fixed] [MP2-799] New Manual Schedule issue. 2.2 Archive 8
    H MP1.21F video database scan, can it be scheduled to automatically run in background General Support 5
    N [Proposal] How to improve series scheduling MediaPortal 2 72
    lacanox XMLTV not writing the tv schedule Electronic Program Guide 3
    T Scheduled recording not starting at the correct time General 13
    Similar threads

    Top Bottom