From a3b8ae3ffd23eccb3020ef472599ef329736645e Mon Sep 17 00:00:00 2001 From: "E.Smith" <31170571+azlm8t@users.noreply.github.com> Date: Tue, 5 Dec 2017 16:43:52 +0000 Subject: [PATCH] dvr: Add autorec for new-only. (#1167). Previously we had "all", "new/unknown", and "repeat", but no ability to only record episodes marked as "new". So we rename DVR_AUTOREC_BTYPE_NEW to DVR_AUTOREC_BTYPE_NEW_OR_UNKNOWN to remain backward compatibility with existing autorec rules and add new semantics for DVR_AUTOREC_BTYPE_NEW. We don't update htsp since it currently does not send the broadcast type field. Also alter DVR_AUTOREC_BTYPE_NEW_OR_UNKNOWN since previously we never checked 'new' but instead checked 'repeat'. However, SD has a previously-shown for all programmes (even first showings) which causes us to mark programmes as repeat. It is difficult to fix the repeat logic without breaking existing behaviour since in the US a programme can be a premiere but have a previously-shown of the previous day due to timezone differences on the coasts. Similarly, programmes can be premiere outside the US but have a previously shown date from the US or from a different channel. For that reason we now check 'new' instead of 'repeat'. Real example: Programme is shown on channel A at 9pm and on A+1 timeshift channel at 10pm. Both are marked as "new" in the paper/OTA tv guide. However, the programme was actually first shown three years ago on a premium channel, so it's actually also a repeat since it has been shown before. So the programme is both a new episode and a repeat episode. Similarly, one of my tv channel insists Roger Moore Bond films from the 1970s are "new" even though most people would consider them a repeat, but since it's the first time that particular channel has aired it they use the "new" tag. Issue: #1167. --- src/dvr/dvr.h | 5 +++-- src/dvr/dvr_autorec.c | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index 6f674557a..69a4169a4 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -325,8 +325,9 @@ typedef enum { typedef enum { DVR_AUTOREC_BTYPE_ALL = 0, - DVR_AUTOREC_BTYPE_NEW = 1, - DVR_AUTOREC_BTYPE_REPEAT = 2 + DVR_AUTOREC_BTYPE_NEW_OR_UNKNOWN = 1, + DVR_AUTOREC_BTYPE_REPEAT = 2, + DVR_AUTOREC_BTYPE_NEW = 3, } dvr_autorec_btype_t; /** diff --git a/src/dvr/dvr_autorec.c b/src/dvr/dvr_autorec.c index 3668aa6e0..9ddcd10b4 100644 --- a/src/dvr/dvr_autorec.c +++ b/src/dvr/dvr_autorec.c @@ -182,9 +182,11 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e) } if(dae->dae_btype != DVR_AUTOREC_BTYPE_ALL) { - if (dae->dae_btype == DVR_AUTOREC_BTYPE_NEW && e->is_repeat) + if (dae->dae_btype == DVR_AUTOREC_BTYPE_NEW_OR_UNKNOWN && e->is_repeat) return 0; - if (dae->dae_btype == DVR_AUTOREC_BTYPE_REPEAT && e->is_repeat == 0) + else if (dae->dae_btype == DVR_AUTOREC_BTYPE_NEW && !e->is_new) + return 0; + else if (dae->dae_btype == DVR_AUTOREC_BTYPE_REPEAT && e->is_repeat == 0) return 0; } @@ -1051,6 +1053,8 @@ dvr_autorec_entry_class_btype_list ( void *o, const char *lang ) { N_("Any"), DVR_AUTOREC_BTYPE_ALL }, { N_("New / premiere / unknown"), + DVR_AUTOREC_BTYPE_NEW_OR_UNKNOWN }, + { N_("New / premiere"), DVR_AUTOREC_BTYPE_NEW }, { N_("Repeated"), DVR_AUTOREC_BTYPE_REPEAT }, -- 2.47.3