[mythtv] auto expire problem with "max episodes" option

Michael T. Dean mtdean at thirdcontact.com
Thu Oct 9 11:16:39 UTC 2014

On 10/07/2014 02:04 PM, George Nassas wrote:
> I'm running current master and have been seeing some odd behaviour with recording rules which have a maximum number of episodes to keep and are set to delete old episodes when the limit is reached.
> The problem is myth fails to do deletes when it seems generic unidentified episodes, they just pile up until N number of identified episodes are recorded and then myth deletes everything down to the limit.
> This problem seems to have started some time late last spring, maybe May or June, because one show I record hasn't expired anything since last June even though it's way past its limit. The rule limit for that program is 26 and myth is now sitting on 117 episodes.
> Reviewing AutoExpire::ExpireEpisodesOverMax I see some good logic to iterate through each recording rule with a limit and to count up non-preserved recordings associated with each rule until I get to this line near the bottom of the method:
>                      {
>                          episodeParts[episodeKey] = 1;
>                          if( duplicate )
>                              found++;
>                      }
> "found" is the count of recordings potentially over the max when "duplicate" is the column from the recorded table. It seems wrong to only count duplicates when counting episodes, the opposite is what ought to be happening unless I'm missing some subtle angle. I'm happy to send in a one-character patch if somebody can confirm a bug.

That's not a bug--"duplicate" doesn't mean it's a duplicate.  The 
duplicate column only identifies an episode as one that /should/ be used 
in duplicate matching (i.e. one that MythTV should acknowledge as having 
been recorded)--it says nothing at all about whether or not it's a 
duplicate episode.  The code ensures we don't count episodes that the 
user has told MythTV to "forget" it recorded (where the user hopes it 
will re-air and MythTV can re-record the episode) since the user's 
marking it to allow re-record means the user has manually identified a 
problem with it and (because they've already manually marked it to allow 
re-record), they can also choose to keep it or manually delete it.  See:


> Despite the funkiness above episode limits do seem to work for my rules that have identified episodes which makes me think there is some other place where tests and deletions are done. Probably as part of the start of recording but I haven't been able to find where. Could someone point me in the right direction and I'll investigate and work up a patch.

Please post a mythbackend log running with -v file showing the 
autoexpire run.  You should see information such as the total number of 
episodes it's identifying for each recording rule with max episodes 
set.  My best guess is that the "extra" episodes are from rules that no 
longer exist (i.e. recid has changed on those rules) or exist in the 
Live TV or Deleted recording group or something like that.


More information about the mythtv-dev mailing list