From: Jaroslav Kysela Date: Thu, 28 Jan 2016 13:55:07 +0000 (+0100) Subject: DVR autorec: add new/premiere and repeated broadcast conditions X-Git-Tag: v4.2.1~1101 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8b906ac75f0979d96d1639852ffd2435f6c6953e;p=thirdparty%2Ftvheadend.git DVR autorec: add new/premiere and repeated broadcast conditions --- diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index fbc87d434..47e9ce2c3 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -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; diff --git a/src/dvr/dvr_autorec.c b/src/dvr/dvr_autorec.c index 0dcecd08f..2e222f27d 100644 --- a/src/dvr/dvr_autorec.c +++ b/src/dvr/dvr_autorec.c @@ -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", diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 935727cb6..461ddcfcf 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -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',