[mythtv] Services bug with dupin field

David Engel david at istwok.net
Sat Aug 22 01:09:21 UTC 2020

On Fri, Aug 21, 2020 at 02:48:27PM -0400, Peter Bennett wrote:
> MythTV Devs
> The dupin (Dup Scope) field in the record table is used for telling whether
> to check for duplicates in Recorded, Oldrecorded, or both. It is also used
> to indicate whether to record only "new episodes" or "new and repeat
> episodes". The value for "new episodes" is 0x10 and that is "ored" with the
> other duplicate settings (0x01, 0x02, 0x0f). The toRawString and other
> similar functions in recordingtypes.cpp assign the value "New Episodes Only"
> to the value 16 but that is never found, as the 0x10 flag is always set in
> conjunction with other values, so if you have "Record New Episodes Only"
> selected, the services apis GetRecordSchedule and GetRecordScheduleList
> return "Unknown" for Dupin.
> I propose changing the toRawString and similar routines to return the value
> "New Episodes Only" when the 0x10 bit is set, regardless of other values,
> since checking for duplicates is moot if you are recording new episodes
> only, and "Unknown" is not helpful.

That's not correct.  New Episodes Only is *not* a filter like the New
Episodes filter.  Rules using thie New Episodes Only still match all
episodes.  However, if a program is not new(*), it is marked with
RecStatus::Repeat.  In contrast, the New Episode filter doesn't match
repeat programs at all.

(*)"New" is determined by the repeat flag.  Originally, this was
defined as something like within 2 weeks of the original air date.
The details might have changed over the years, but the intent is still
the same.  Anyway, duplicate checking is still needed when New
Episodes Only is used as many channels repeat new programs one or more
times the first week they are shown.

> In the case of the "AddRecordSchedule" method, setting "New Episodes Only"
> will currently set a value of 0x10. This is invalid since creation of record
> rules through the frontend never results in this value. In the frontend you
> always have to also set where to check duplicates, you cannot set it to
> check duplicates in neither recorded nor oldrecorded (even if you selected
> "Dont Match Duplicates" in the dup method)
> I propose changing dupInFromString so that if you set "new episodes only" it
> combines that with "all recordings".  Otherwise if you create a record rule
> through the api using "new episodes only" and subsequently edit it through
> the frontend to take off "new episodes only" you may be left with a rule
> having an invalid dupin of zero.
> Any comments or suggestions? Let me know.

I think the best solutino is to split the new episodes only/new and
repeat value out into a totally new value.  The trick will be to
maintain as much backward compatibility as you can.

> The frontend is a bit inconsistent - if you select "don't match duplicates"
> it prevents you from changing "dup scope" but if you selected "new episodes
> only" you can still select duplicate checking methods and scope.

The overloading of dupscope to include the new/repeat functionality
was an unfortunate decision.  I was around then but don't remember why
it was done that way.

David Engel
david at istwok.net

More information about the mythtv-dev mailing list