]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
DVR: Added configurable EPG update window
authorJaroslav Kysela <perex@perex.cz>
Thu, 18 Sep 2014 10:43:07 +0000 (12:43 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 18 Sep 2014 10:43:07 +0000 (12:43 +0200)
src/dvr/dvr.h
src/dvr/dvr_config.c
src/dvr/dvr_db.c

index 36719ba68c0a562b1ddea62d68f3cf090b8b36fa..0bc370677539710788d0d74ed15add8551f2b637 100644 (file)
@@ -41,6 +41,7 @@ typedef struct dvr_config {
   char *dvr_postproc;
   uint32_t dvr_extra_time_pre;
   uint32_t dvr_extra_time_post;
+  uint32_t dvr_update_window;
 
   int dvr_mc;
   muxer_config_t dvr_muxcnf;
index 741a736e8bc8efa5aa1787e005dce0a6c04c7969..77e78654be74f3d691ccd130ddcf8ca45e46daed 100644 (file)
@@ -146,6 +146,7 @@ dvr_config_create(const char *name, const char *uuid, htsmsg_t *conf)
   cfg->dvr_tag_files = 1;
   cfg->dvr_skip_commercials = 1;
   dvr_charset_update(cfg, intlconv_filesystem_charset());
+  cfg->dvr_update_window = 24 * 3600;
 
   /* series link support */
   cfg->dvr_sl_brand_lock   = 1; // use brand linking
@@ -367,6 +368,12 @@ dvr_config_class_cache_list(void *o)
   return strtab2htsmsg(tab);
 }
 
+static htsmsg_t *
+dvr_config_entry_class_update_window_list(void *o)
+{
+  return dvr_entry_class_duration_list(o, "Update Disabled", 24*3600, 60);
+}
+
 const idclass_t dvr_config_class = {
   .ic_class      = "dvrconfig",
   .ic_caption    = "DVR Configuration Profile",
@@ -469,6 +476,15 @@ const idclass_t dvr_config_class = {
       .off      = offsetof(dvr_config_t, dvr_episode_duplicate),
       .group    = 1,
     },
+    {
+      .type     = PT_U32,
+      .id       = "epg-update-window",
+      .name     = "EPG Update Window",
+      .off      = offsetof(dvr_config_t, dvr_update_window),
+      .list     = dvr_config_entry_class_update_window_list,
+      .def.u32  = 24*3600,
+      .group    = 1,
+    },
     {
       .type     = PT_STR,
       .id       = "postproc",
index 3a470880b7ff53666fb6f55eb52be7929972aae0..16326db4a69e2b969f9ef620746dd8683394c832 100644 (file)
@@ -358,8 +358,8 @@ dvr_entry_fuzzy_match(dvr_entry_t *de, epg_broadcast_t *e)
   if ( abs(t2 - t1) > (t1 / 5) )
     return 0;
 
-  /* Outside of window (should it be configurable)? */
-  if ( abs(e->start - de->de_start) > 86400 )
+  /* Outside of window */
+  if ( abs(e->start - de->de_start) > de->de_config->dvr_update_window )
     return 0;
   
   /* Title match (or contains?) */
@@ -1598,7 +1598,7 @@ dvr_entry_class_duration_list(void *o, const char *not_set, int max, int step)
     htsmsg_add_str(e, "val", buf);
     htsmsg_add_msg(l, NULL, e);
   }
-  for (i = 120; i <= max;  i += 30) {
+  for (i = 120; i <= max; i += 30) {
     if ((i % 60) == 0)
       snprintf(buf, sizeof(buf), "%d hrs", i / 60);
     else