Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR: Added configurable EPG update window
  • Loading branch information
perexg committed Sep 18, 2014
1 parent c571413 commit 4f494c6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/dvr/dvr.h
Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions src/dvr/dvr_config.c
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/dvr/dvr_db.c
Expand Up @@ -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?) */
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4f494c6

Please sign in to comment.