]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
DVR autorec: add new/premiere and repeated broadcast conditions
authorJaroslav Kysela <perex@perex.cz>
Thu, 28 Jan 2016 13:55:07 +0000 (14:55 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 28 Jan 2016 13:55:07 +0000 (14:55 +0100)
src/dvr/dvr.h
src/dvr/dvr_autorec.c
src/webui/static/app/dvr.js

index fbc87d434a3abef2bdddf0d44a733f47f2629f86..47e9ce2c35406cfdd3b000b7f3a7b09a0d232041 100644 (file)
@@ -295,6 +295,11 @@ typedef enum {
   DVR_AUTOREC_LRECORD_ONCE_PER_DAY = 11,
 } dvr_autorec_dedup_t;
 
+typedef enum {
+  DVR_AUTOREC_BTYPE_ALL = 0,
+  DVR_AUTOREC_BTYPE_NEW = 1,
+  DVR_AUTOREC_BTYPE_REPEAT = 2
+} dvr_autorec_btype_t;
 
 /**
  * Autorec entry
@@ -344,6 +349,7 @@ typedef struct dvr_autorec_entry {
   int dae_maxduration;
   uint32_t dae_retention;
   uint32_t dae_removal;
+  uint32_t dae_btype;
   uint32_t dae_max_count;
   uint32_t dae_max_sched_count;
 
index 0dcecd08f10813b6a04d75716bc8ba74e81f9674..2e222f27d7b019e2cec2f231ad24655e4f2870a2 100644 (file)
@@ -167,6 +167,12 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
     if(dae->dae_brand)
       if (!e->episode->brand || dae->dae_brand != e->episode->brand) return 0;
   }
+  if(dae->dae_btype != DVR_AUTOREC_BTYPE_ALL) {
+    if (dae->dae_btype == DVR_AUTOREC_BTYPE_NEW && e->is_repeat)
+      return 0;
+    if (dae->dae_btype == DVR_AUTOREC_BTYPE_REPEAT && e->is_repeat == 0)
+      return 0;
+  }
   if(dae->dae_title != NULL && dae->dae_title[0] != '\0') {
     lang_str_ele_t *ls;
     if (!dae->dae_fulltext) {
@@ -947,6 +953,20 @@ dvr_autorec_entry_class_dedup_list ( void *o, const char *lang )
   return strtab2htsmsg(tab, 1, lang);
 }
 
+static htsmsg_t *
+dvr_autorec_entry_class_btype_list ( void *o, const char *lang )
+{
+  static const struct strtab tab[] = {
+    { N_("Any"),
+        DVR_AUTOREC_BTYPE_ALL },
+    { N_("New / premiere / unknown"),
+        DVR_AUTOREC_BTYPE_NEW },
+    { N_("Repeated"),
+        DVR_AUTOREC_BTYPE_REPEAT },
+  };
+  return strtab2htsmsg(tab, 1, lang);
+}
+
 static uint32_t
 dvr_autorec_entry_class_owner_opts(void *o)
 {
@@ -1031,6 +1051,26 @@ const idclass_t dvr_autorec_entry_class = {
       .list     = channel_tag_class_get_list,
       .opts     = PO_ADVANCED
     },
+    {
+      .type     = PT_U32,
+      .id       = "btype",
+      .name     = N_("Broadcast type"),
+      .desc     = N_("Select type of broadcast (all, new/premiere or repeat)."),
+      .def.i    = DVR_AUTOREC_BTYPE_ALL,
+      .off      = offsetof(dvr_autorec_entry_t, dae_btype),
+      .list     = dvr_autorec_entry_class_btype_list,
+      .opts     = PO_HIDDEN | PO_ADVANCED,
+    },
+    {
+      .type     = PT_U32,
+      .id       = "content_type",
+      .name     = N_("Content type"),
+      .desc     = N_("The content type (Movie/Drama, Sports, etc.) to "
+                     "be used to filter matching events/programmes."),
+      .list     = dvr_autorec_entry_class_content_type_list,
+      .off      = offsetof(dvr_autorec_entry_t, dae_content_type),
+      .opts     = PO_ADVANCED
+    },
     {
       .type     = PT_STR,
       .id       = "start",
@@ -1109,16 +1149,6 @@ const idclass_t dvr_autorec_entry_class = {
       .off      = offsetof(dvr_autorec_entry_t, dae_maxduration),
       .opts     = PO_ADVANCED
     },
-    {
-      .type     = PT_U32,
-      .id       = "content_type",
-      .name     = N_("Content type"),
-      .desc     = N_("The content type (Movie/Drama, Sports, etc.) to "
-                     "be used to filter matching events/programmes."),
-      .list     = dvr_autorec_entry_class_content_type_list,
-      .off      = offsetof(dvr_autorec_entry_t, dae_content_type),
-      .opts     = PO_ADVANCED
-    },
     {
       .type     = PT_U32,
       .id       = "pri",
index 935727cb69ebf47b7e6a04323647aede3d7b6840..461ddcfcf0179bed990d9c649b71993e6eba7c5b 100644 (file)
@@ -581,6 +581,7 @@ tvheadend.autorec_editor = function(panel, index) {
             fulltext:     { width: 70 },
             channel:      { width: 200 },
             tag:          { width: 200 },
+            btype:        { width: 50 },
             content_type: { width: 100 },
             minduration:  { width: 100 },
             maxduration:  { width: 100 },
@@ -607,14 +608,14 @@ tvheadend.autorec_editor = function(panel, index) {
         add: {
             url: 'api/dvr/autorec',
             params: {
-               list: 'enabled,name,directory,title,fulltext,channel,tag,content_type,minduration,' +
+               list: 'enabled,name,directory,title,fulltext,channel,tag,btype,content_type,minduration,' +
                      'maxduration,weekdays,start,start_window,pri,dedup,retention,removal,' +
                      'maxcount,maxsched,config_name,comment'
             },
             create: { }
         },
         del: true,
-        list: 'enabled,name,directory,title,fulltext,channel,tag,content_type,minduration,' +
+        list: 'enabled,name,directory,title,fulltext,channel,tag,btype,content_type,minduration,' +
               'maxduration,weekdays,start,start_window,pri,dedup,config_name,owner,creator,comment',
         sort: {
           field: 'name',