Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR autorec: add new/premiere and repeated broadcast conditions
  • Loading branch information
perexg committed Jan 28, 2016
1 parent 275dea5 commit 8b906ac
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/dvr/dvr.h
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
50 changes: 40 additions & 10 deletions src/dvr/dvr_autorec.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions src/webui/static/app/dvr.js
Expand Up @@ -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 },
Expand All @@ -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',
Expand Down

0 comments on commit 8b906ac

Please sign in to comment.