]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: Add minseason and maxseason to autorec (#5176)
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Thu, 20 Sep 2018 19:00:37 +0000 (20:00 +0100)
committerperexg <perex@perex.cz>
Wed, 26 Sep 2018 15:29:51 +0000 (17:29 +0200)
This allows users to specify specific seasons to record,
it has to be >= min and <= max.

For example min=5,max=5 will record only season 5.

Setting min=5,max=0 will record everything on season 5 or
later, which is useful if you've already seen seasons 1--4.

This can then be combined with the normal fulltext regex
such as "Simpsons"+minseason=12.

Fixes: #5176
src/dvr/dvr.h
src/dvr/dvr_autorec.c
src/webui/static/app/dvr.js

index 9ce03d6ba9f220b9a2133df2e63b8557361963af..d6a57acca44e09e8634111399dded7507e0b9087 100644 (file)
@@ -404,6 +404,8 @@ typedef struct dvr_autorec_entry {
   int dae_maxduration;
   int dae_minyear;
   int dae_maxyear;
+  int dae_minseason;
+  int dae_maxseason;
   uint32_t dae_retention;
   uint32_t dae_removal;
   uint32_t dae_btype;
index f8be3fbdb263d3a1ca99e5269c24833b44c00d3f..ed7c9cd94115cc11926c7d8c0145ae6dd042a00d 100644 (file)
@@ -166,6 +166,8 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
      (dae->dae_maxduration <= 0 || dae->dae_maxduration > 24 * 3600) &&
      dae->dae_minyear <= 0 &&
      dae->dae_maxyear <= 0 &&
+     dae->dae_minseason <= 0 &&
+     dae->dae_maxseason <= 0 &&
      dae->dae_serieslink_uri == NULL)
     return 0; // Avoid super wildcard match
 
@@ -270,6 +272,14 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
     if(e->copyright_year > dae->dae_maxyear) return 0;
   }
 
+  if(dae->dae_minseason > 0) {
+    if(e->epnum.s_num < dae->dae_minseason) return 0;
+  }
+
+  if(dae->dae_maxseason > 0) {
+    if(e->epnum.s_num > dae->dae_maxseason) return 0;
+  }
+
   if(dae->dae_weekdays != 0x7f) {
     struct tm tm;
     localtime_r(&e->start, &tm);
@@ -1259,6 +1269,22 @@ const idclass_t dvr_autorec_entry_class = {
       .off      = offsetof(dvr_autorec_entry_t, dae_maxyear),
       .opts     = PO_EXPERT | PO_DOC_NLIST,
     },
+    {
+      .type     = PT_U16,
+      .id       = "minseason",
+      .name     = N_("Minimum season"),
+      .desc     = N_("The earliest season for the programme. Programmes must be equal to or later than this season."),
+      .off      = offsetof(dvr_autorec_entry_t, dae_minseason),
+      .opts     = PO_EXPERT | PO_DOC_NLIST,
+    },
+    {
+      .type     = PT_U16,
+      .id       = "maxseason",
+      .name     = N_("Maximum season"),
+      .desc     = N_("The latest season for the programme. Programmes must be equal to or earlier than this season."),
+      .off      = offsetof(dvr_autorec_entry_t, dae_maxseason),
+      .opts     = PO_EXPERT | PO_DOC_NLIST,
+    },
     {
       .type     = PT_U32,
       .id       = "pri",
index af7b31e22a61e9da5aee188abe1a34e1444467b8..4a642a193177121d815bb3a8da5e9cc2d2e470dc 100644 (file)
@@ -972,7 +972,7 @@ tvheadend.dvr_settings = function(panel, index) {
 tvheadend.autorec_editor = function(panel, index) {
 
     var list = 'name,title,fulltext,channel,start,start_window,weekdays,' +
-               'record,tag,btype,content_type,cat1,cat2,cat3,minduration,maxduration,minyear,maxyear,' +
+               'record,tag,btype,content_type,cat1,cat2,cat3,minduration,maxduration,minyear,maxyear,minseason,maxseason,' +
                'star_rating,dedup,directory,config_name,comment,pri';
     var elist = 'enabled,start_extra,stop_extra,' +
                 (tvheadend.accessUpdate.admin ?