Fix Recordings to respect Recording limit (1 Viewer)

azeroth

Portal Member
June 10, 2015
14
10
37
Home Country
United States of America United States of America
Summary:

Stop recording new episodes when limit is reached for until I watch/keep until/until I delete KeepMethod types.
I think that the episode limit should always restrict recording. Right now if you have any of the three keep types above, the recorder will record every episode as if no limit was applied.

Area:
TV Server

Description:

Just check for episode count before starting a recording for the above types.

Template code:

Scheduler.cs
New helper Method:
Code:
private bool IsEpisodeMaxReached(Schedule schedule)
    {
        IList<Recording> recordings = Recording.ListAll();
        var episodeManagement = new EpisodeManagement();
        List<Recording> episodes = episodeManagement.GetEpisodes(schedule.ProgramName, recordings);
        if (episodes.Count >= schedule.MaxAirings && (schedule.KeepMethod ==  (int)KeepMethodType.Always || schedule.KeepMethod == (int)KeepMethodType.UntilWatched))
        {
            return true;
        }
        return false;
    }

in StartAnyDueRecordings() method
Code:
...
if (IsEpisodeUnrecorded(schedule.ScheduleType, newRecording) && !IsEpisodeMaxReached(schedule))
...


Summary:

This code is untested but seems like it should do the trick.
Also an [won't be recorded] icon could be added to the guide to show that it wont be recorded because it will exceed the limit. I didn't dig this far though.
 

Edalex

Community Plugin Dev
  • Premium Supporter
  • January 3, 2008
    2,955
    1,264
    Saratov
    Home Country
    Russian Federation Russian Federation
    It's awesome that someone from US looked at TV Server code. (y) Mediaportal always had lack of US based developers.
    Since TV server now have version 3 and 3.5 patches for both of them are needed as I know.
     

    azeroth

    Portal Member
    June 10, 2015
    14
    10
    37
    Home Country
    United States of America United States of America
    Haha thanks! Yeah I'm giving up on my wmc/kodi combo for now and diving into mp. I'll have to get the repo stuff setup and I may be able to contribute some. I'm not positive I understand your last sentence. Are you saying it has already been implemented? Or that it could/should be added?
     

    Edalex

    Community Plugin Dev
  • Premium Supporter
  • January 3, 2008
    2,955
    1,264
    Saratov
    Home Country
    Russian Federation Russian Federation
    I'm not an expert but I'll try :D Our current stable version of TV Server which is bundled with Mediaportal 1 is called TVE3. It's master branch is equal to MP1 master. But we also have rework of TVServer which is called TVE3.5. In order not to interfere TVE3.5 development it was stated that TVE3 is in code-freeze state. But MP Team agreed that changes to TVE3 could be done only if the same changes will be applied to TVE3.5 too. [emoji27] That was the full meaning of my words.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Implementation note...
    I have added an additional "keep method" - "until episode limit" - for the people that want new episodes to be recorded and old episodes to be deleted automatically (ie. current behaviour). When this keep method is used, people don't have to watch, set an expiry date on, or manually delete old episodes in order for new episodes to be recorded. In other words, this new option ensures people have a way to keep the current behaviour.
     

    azeroth

    Portal Member
    June 10, 2015
    14
    10
    37
    Home Country
    United States of America United States of America
    Makes sense. In my mind I figured that's what "until space is needed" was for but I guess that probably means overall disk space not just space for the current schedule. Thanks!
     

    Users who are viewing this thread

    Top Bottom