Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#10747 closed Patch - Feature (fixed)

[PATCH] Autogenerate originalairdate for new episode repeats

Reported by: Bradley Baetz <bbaetz@…> Owned by: stuartm
Priority: minor Milestone: 0.27
Component: MythTV - Mythfilldatabase Version: 0.25-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Not all xmltv sources include the original airdate in the <previously-shown> element (mine doesn't).

Without this, conflicts (either directly, or that could be resolved with the "reschedule higher priorities" option) don't cause a later repeat to be triggered for "new episode only" recording rules, because the second showing isn't marked as new in the guide data.

The code in mythfilldatabase fixes this by changing the 'previouslyshown' field in the DB, but this only happens if the original airdate is within NewEpisodeWindow? days, so without the original airdate field in the xmltv data that code doesn't trigger.

However, in all the cases that this will make a difference to scheduling, the first showing is probably in the collected guide data anyway, so we can use that to set the originalairdate field.

The attached patch sets the originalairdate if that field is not in the xmltv data, its a repeat showing, and there is a matching new episode in the program data. Its simplest to do that at the same time as first/last is being set (and to use the same matching rules), so I moved that code before the check for repeats.

I also changed the housekeeping process to keep at least NewEpisodeWindow? days of guide data, so that this can work (this effectively changes the default guide keeptime from 10 to 14 days). That may not be a good idea if people set that setting quite high for some reason, though.

The same thing could presumably be done for EIT data, but I don't use that.

Attachments (2)

mythtv.airdate.patch (8.2 KB) - added by Bradley Baetz <bbaetz@…> 12 years ago.
Patch
mythtv.airdate.2.patch (9.6 KB) - added by Bradley Baetz <bbaetz@…> 11 years ago.
Updated patch

Download all attachments as: .zip

Change History (7)

Changed 12 years ago by Bradley Baetz <bbaetz@…>

Attachment: mythtv.airdate.patch added

Patch

comment:1 Changed 11 years ago by David Engel <dengel@…>

Resolution: fixed
Status: newclosed

In d4f6995cf2e4743f452084c8c56bb33c9e6c0372/mythtv:

Attempt to fill in some missing original airdates.

If the guide data provides an original airdate for some showings of a
program but not for others, use the provided one to fill in the other
missing ones. Based on a patch from Bradley Baetz, but implemented a
little differently.

Fixes #10747

comment:2 Changed 11 years ago by gigem

Milestone: unknown0.27

comment:3 Changed 11 years ago by bbaetz@…

Resolution: fixed
Status: closednew

Unfortunately what was checked in doesn't work for me. It joins on programid, but that isn't present in my (Australian) guide data. The part of my patch that handled that wasn't applied. The safety check for a new episode also was missed, although that's probably less important if there is a programid.

Also, it turns out that my patch was slightly wrong - my patch would not necessarily select the right previously shown flag. That's because its undefined which row's value for a non-grouped column is selected (most DBs won't even let you do it) so in some cases it would pick up the original episode's value of 1 and other times it would pick up 0, so the safety check (against generic episodes descriptions) wouldn't kick in.

This is fixed in the attached patch which I've been using (on 0.25-fixes) for the last week or so, since I discovered this issue. (This is still against 0.25, but should apply to 0.27 with the committed stuff here reverted)

Changed 11 years ago by Bradley Baetz <bbaetz@…>

Attachment: mythtv.airdate.2.patch added

Updated patch

comment:4 Changed 11 years ago by David Engel <dengel@…>

Resolution: fixed
Status: newclosed

In beb9f8e1527b46883d1b95dc7975a5c10cd1290c/mythtv:

Fill in missing original airdates for programs without programids.

Extend d4f6995c to also handle programs without programids. Note,
this does not allow setting the original airdate for a program with a
programid from a program without a programid and vice versa. I don't
want to handle that case unless and until I can see some real world
cases of needing it.

Fixes #10747 . Bradley Baetz, if this still doesn't meet your needs,
please rework your patch along the lines of what is already done here.
I will not accept any patch which mixes this fixup with others like
your current one does with the first/last showing fixup.

comment:5 Changed 11 years ago by Bradley Baetz <bbaetz@…>

Hmm, not quite:

  • shepherd never populates originalairdate, so its always missing and the select doesn't match. That's fixable in shepherd by just setting it on "new" episodes to the current date (assuming that the "standard" US grabbers do that?)
  • What I really need is for the original airdate for the repeat to be the MAX(originalairdate) such that originalairdate < startdate That handles daily shows that show twice a day, once for the original and once for the repeat (this is why I was using first/last)

Will think about it this weekend and see what I can do without it become too complicated.

Note: See TracTickets for help on using tickets.