[TV] Unable to delete schedules (1 Viewer)

arion_p

Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    gibman:
    I see only one thing that your patch doesn't fix and worries me. In TVProgramInfo.CancelProgram(), in line 994 (unpatched version) you have the following:
    Code:
            [COLOR=Red]schedule.StartTime = program.StartTime;[/COLOR]
            TVHome.PromptAndDeleteRecordingSchedule(schedule.IdSchedule, deleteEntireSched, false);
            Program.ResetPendingState(program.IdProgram);
    This is very risky. Gentle will cache instances of DB records and keeps only one in-memory instance of each record per App. So when you change schedule.StartTime you are changing it in that single global instance. Later any call to Schedule.Retrieve() for the same schedule will return this modified instance, with unpredictable results.

    Edit: It can get even worse: If Persist() is called at some other place in the code, the modified start time will be persisted to the database.
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    hi arion.

    Thanks for your review and feedback.

    I've attached new rev. of the code.

    added X nr of overloaded methods containing : "datetime canceledStartTime".

    /gibman

    @gibman:
    I see only one thing that your patch doesn't fix and worries me. In TVProgramInfo.CancelProgram(), in line 994 (unpatched version) you have the following:
    Code:
            [COLOR=Red]schedule.StartTime = program.StartTime;[/COLOR]
            TVHome.PromptAndDeleteRecordingSchedule(schedule.IdSchedule, deleteEntireSched, false);
            Program.ResetPendingState(program.IdProgram);
    This is very risky. Gentle will cache instances of DB records and keeps only one in-memory instance of each record per App. So when you change schedule.StartTime you are changing it in that single global instance. Later any call to Schedule.Retrieve() for the same schedule will return this modified instance, with unpredictable results.

    Edit: It can get even worse: If Persist() is called at some other place in the code, the modified start time will be persisted to the database.
     

    Attachments

    • scheduler_0.2.zip
      30.6 KB

    ronilse

    Retired Team Member
  • Premium Supporter
  • July 19, 2005
    4,422
    283
    Moss
    Home Country
    Norway Norway
    Hi,
    Tested version 2 & works good on my setup, so thx!

    Regards
    Roy
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    How do I get round the versin issue with this DLL?
    Code:
    ---------------------------
    MediaPortal
    ---------------------------
    TvPlugin and MediaPortal don't have the same version.
    
    Please update the older component to the same version as the newer one.
    
    MediaPortal Version: 1.0.4.24669
    
    TvPlugin    Version: 1.0.4.0
    ---------------------------
    OK   
    ---------------------------
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Tested version 2 & works good on my setup, so thx!
    Seemed to work pretty well on my machine except the ordering has changed. With the replacement DLL the scheduled recordings are ordered with the first recording to take place at the bottom of the list and the furthest away at the top.

    Also I did have an instance where I setup a schedule and deleted two programs but when I went to look at the entries in the database after closing MP with alt+f4 there was nothing there. Went back into MP and whole schedule was gone. I think this was me clicking wrong option and deleted entire schedule and not just one show. Will try and test some more tomorrow
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    thanks for testing.

    The date sorting on the scheduled view seems all weird regardless of what version of tvplugin you run.

    I just added a "record-everytime-on-this-channel" schedule both using my modified plugin as well as using the latest from svn.

    The both yield the same result.
    The schedule is presented at the bottom of the list of series schedules.

    When not using the series view, the sorting makes more sense.

    It also let me realize that the series sorting is probably done on the initial starttime of the schedule record.
    Many of my schedules has this date set in 2009, since they are old, but still active though.
    That's why my newly added test schedule is seen as "older" in context to the date sorting.

    Shouldn't the series view when sorted by date sort be sorted by the first upcoming episode instead ?

    ex. I have an old but still active schedule "generals @ war".
    So the schedule-episode view shows me schedules from way back in 2009.
    This adds to the noise.

    If I use the series view and enter the series in question (generals @ war), then the episodes presented are much better.
    It only shows the upcoming episodes and not the old noisy ones.

    /gibman

    Tested version 2 & works good on my setup, so thx!
    Seemed to work pretty well on my machine except the ordering has changed. With the replacement DLL the scheduled recordings are ordered with the first recording to take place at the bottom of the list and the furthest away at the top.

    Also I did have an instance where I setup a schedule and deleted two programs but when I went to look at the entries in the database after closing MP with alt+f4 there was nothing there. Went back into MP and whole schedule was gone. I think this was me clicking wrong option and deleted entire schedule and not just one show. Will try and test some more tomorrow
     

    ronilse

    Retired Team Member
  • Premium Supporter
  • July 19, 2005
    4,422
    283
    Moss
    Home Country
    Norway Norway
    Hi,
    Yeah the sort seems a bit weird but it's not a result of the changes. That said i also had all schedules in one series rec removed but that was before this fix & could be my broken mouse which double clicked & hung which causes issues for fun, have a new one now & not seen it happen again, but will have a eye on it since it could ofc be a bug in there somewhere ;)

    Regards
    Roy
     

    Users who are viewing this thread

    Top Bottom