DVR: autorec duration fixes
This commit is contained in:
parent
0506aac6c1
commit
9858ed04cd
4 changed files with 28 additions and 15 deletions
|
@ -395,6 +395,7 @@ void dvr_entry_cancel_delete(dvr_entry_t *de);
|
|||
|
||||
htsmsg_t *dvr_entry_class_pri_list(void *o);
|
||||
htsmsg_t *dvr_entry_class_config_name_list(void *o);
|
||||
htsmsg_t *dvr_entry_class_duration_list(void *o, const char *not_set, int max);
|
||||
|
||||
/**
|
||||
* Query interface
|
||||
|
|
|
@ -81,8 +81,8 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
|
|||
dae->dae_title[0] == '\0') &&
|
||||
dae->dae_brand == NULL &&
|
||||
dae->dae_season == NULL &&
|
||||
dae->dae_minduration == 0 &&
|
||||
(dae->dae_maxduration == 0 || dae->dae_maxduration > 24 * 3600) &&
|
||||
dae->dae_minduration <= 0 &&
|
||||
(dae->dae_maxduration <= 0 || dae->dae_maxduration > 24 * 3600) &&
|
||||
dae->dae_serieslink == NULL)
|
||||
return 0; // Avoid super wildcard match
|
||||
|
||||
|
@ -141,11 +141,11 @@ autorec_cmp(dvr_autorec_entry_t *dae, epg_broadcast_t *e)
|
|||
|
||||
duration = difftime(e->stop,e->start);
|
||||
|
||||
if(dae->dae_minduration) {
|
||||
if(dae->dae_minduration > 0) {
|
||||
if(duration < dae->dae_minduration) return 0;
|
||||
}
|
||||
|
||||
if(dae->dae_maxduration) {
|
||||
if(dae->dae_maxduration > 0) {
|
||||
if(duration > dae->dae_maxduration) return 0;
|
||||
}
|
||||
|
||||
|
@ -452,6 +452,7 @@ dvr_autorec_entry_class_start_get(void *o)
|
|||
static int
|
||||
dvr_autorec_entry_class_stop_get(void *o)
|
||||
{
|
||||
dvr_autorec_entry_t *dae = (dvr_autorec_entry_t *)o;
|
||||
return dvr_autorec_entry_class_time_get(o, v, &dae->dae_stop);
|
||||
}
|
||||
#endif
|
||||
|
@ -479,8 +480,13 @@ dvr_autorec_entry_class_time_list(void *o)
|
|||
static htsmsg_t *
|
||||
dvr_autorec_entry_class_minduration_list(void *o)
|
||||
{
|
||||
/* reuse */
|
||||
return dvr_autorec_entry_class_time_list(o);
|
||||
return dvr_entry_class_duration_list(o, "Not set", 24*60);
|
||||
}
|
||||
|
||||
static htsmsg_t *
|
||||
dvr_autorec_entry_class_maxduration_list(void *o)
|
||||
{
|
||||
return dvr_entry_class_duration_list(o, "Not set", 24*60);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -735,16 +741,17 @@ const idclass_t dvr_autorec_entry_class = {
|
|||
.rend = dvr_autorec_entry_class_weekdays_rend,
|
||||
},
|
||||
{
|
||||
.type = PT_U32,
|
||||
.type = PT_INT,
|
||||
.id = "minduration",
|
||||
.name = "Minimal Duration",
|
||||
.list = dvr_autorec_entry_class_minduration_list,
|
||||
.off = offsetof(dvr_autorec_entry_t, dae_minduration),
|
||||
},
|
||||
{
|
||||
.type = PT_U32,
|
||||
.type = PT_INT,
|
||||
.id = "maxduration",
|
||||
.name = "Maximal Duration",
|
||||
.list = dvr_autorec_entry_class_maxduration_list,
|
||||
.off = offsetof(dvr_autorec_entry_t, dae_maxduration),
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1522,15 +1522,15 @@ dvr_entry_class_channel_icon_url_get(void *o)
|
|||
return &s;
|
||||
}
|
||||
|
||||
static htsmsg_t *
|
||||
dvr_entry_class_extra_list(void *o)
|
||||
htsmsg_t *
|
||||
dvr_entry_class_duration_list(void *o, const char *not_set, int max)
|
||||
{
|
||||
int i;
|
||||
htsmsg_t *e, *l = htsmsg_create_list();
|
||||
char buf[32];
|
||||
e = htsmsg_create_map();
|
||||
htsmsg_add_u32(e, "key", 0);
|
||||
htsmsg_add_str(e, "val", "Not set (use channel or DVR config)");
|
||||
htsmsg_add_str(e, "val", not_set);
|
||||
htsmsg_add_msg(l, NULL, e);
|
||||
for (i = 1; i <= 120; i++) {
|
||||
snprintf(buf, sizeof(buf), "%d min%s", i, i > 1 ? "s" : "");
|
||||
|
@ -1539,7 +1539,7 @@ dvr_entry_class_extra_list(void *o)
|
|||
htsmsg_add_str(e, "val", buf);
|
||||
htsmsg_add_msg(l, NULL, e);
|
||||
}
|
||||
for (i = 120; i <= 240; i += 30) {
|
||||
for (i = 120; i <= max; i += 30) {
|
||||
if ((i % 60) == 0)
|
||||
snprintf(buf, sizeof(buf), "%d hrs", i / 60);
|
||||
else
|
||||
|
@ -1551,8 +1551,13 @@ dvr_entry_class_extra_list(void *o)
|
|||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
static htsmsg_t *
|
||||
dvr_entry_class_extra_list(void *o)
|
||||
{
|
||||
return dvr_entry_class_duration_list(o, "Not set (use channel or DVR config)", 4*60);
|
||||
}
|
||||
|
||||
static htsmsg_t *
|
||||
dvr_entry_class_content_type_list(void *o)
|
||||
{
|
||||
|
|
|
@ -243,13 +243,13 @@ tvheadend.autorec_editor = function(panel, index) {
|
|||
url: 'api/dvr/autorec',
|
||||
params: {
|
||||
list: 'enable,title,channel,tag,content_type,minduration,' +
|
||||
'weekdays,approx_time,pri,config_name,comment',
|
||||
'maxduration,weekdays,approx_time,pri,config_name,comment',
|
||||
},
|
||||
create: { }
|
||||
},
|
||||
del: true,
|
||||
list: 'enable,title,channel,tag,content_type,minduration,' +
|
||||
'weekdays,approx_time,pri,config_name,creator,comment',
|
||||
'maxduration,weekdays,approx_time,pri,config_name,creator,comment',
|
||||
sort: {
|
||||
field: 'name',
|
||||
direction: 'ASC'
|
||||
|
|
Loading…
Add table
Reference in a new issue