]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: Add autorec for new-only. (#1167).
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Tue, 5 Dec 2017 16:43:52 +0000 (16:43 +0000)
committerJaroslav Kysela <perex@perex.cz>
Sun, 10 Dec 2017 15:41:11 +0000 (16:41 +0100)
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
src/dvr/dvr_autorec.c

index 6f674557a194298810dda1e86ae8eed2d487c14b..69a4169a4435d1155bba5ea4bd3761c26c533498 100644 (file)
@@ -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;
 
 /**
index 3668aa6e0d31ee48e6cead450811d129064d0b90..9ddcd10b44d386b9e0c9055265bc763609d1cf43 100644 (file)
@@ -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 },