Skip to content

Commit a9c6db8

Browse files
dave-pFlole998
authored andcommitted
Improve autorec duplicate handling
1 parent ae97d5b commit a9c6db8

4 files changed

Lines changed: 55 additions & 11 deletions

File tree

‎src/dvr/dvr.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ typedef enum {
356356
DVR_AUTOREC_LRECORD_ONCE_PER_MONTH = 13,
357357
DVR_AUTOREC_LRECORD_ONCE_PER_WEEK = 10,
358358
DVR_AUTOREC_LRECORD_ONCE_PER_DAY = 11,
359-
/* first free value == 15 */
359+
DVR_AUTOREC_RECORD_DVR_PROFILE = 15,
360+
/* first free value == 16 */
360361
} dvr_autorec_dedup_t;
361362

362363
typedef enum {
@@ -765,9 +766,6 @@ void dvr_autorec_completed( dvr_autorec_entry_t *dae, int error_code );
765766

766767
uint32_t dvr_autorec_get_max_sched_count(dvr_autorec_entry_t *dae);
767768

768-
htsmsg_t *
769-
dvr_autorec_entry_class_dedup_list ( void *o, const char *lang );
770-
771769
/**
772770
*
773771
*/

‎src/dvr/dvr_autorec.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ dvr_autorec_create(const char *uuid, htsmsg_t *conf)
406406
dae->dae_start = -1;
407407
dae->dae_start_window = -1;
408408
dae->dae_enabled = 1;
409+
dae->dae_record = DVR_AUTOREC_RECORD_DVR_PROFILE;
409410
dae->dae_config = dvr_config_find_by_name_default(NULL);
410411
LIST_INSERT_HEAD(&dae->dae_config->dvr_autorec_entries, dae, dae_config_link);
411412

@@ -996,10 +997,12 @@ dvr_autorec_entry_class_content_type_list(void *o, const char *lang)
996997
return m;
997998
}
998999

999-
htsmsg_t *
1000+
static htsmsg_t *
10001001
dvr_autorec_entry_class_dedup_list ( void *o, const char *lang )
10011002
{
10021003
static const struct strtab tab[] = {
1004+
{ N_("Use DVR configuration"),
1005+
DVR_AUTOREC_RECORD_DVR_PROFILE },
10031006
{ N_("Record all"),
10041007
DVR_AUTOREC_RECORD_ALL },
10051008
{ N_("All: Record if EPG/XMLTV indicates it is a unique programme"),
@@ -1354,8 +1357,10 @@ const idclass_t dvr_autorec_entry_class = {
13541357
.type = PT_U32,
13551358
.id = "record",
13561359
.name = N_("Duplicate handling"),
1357-
.desc = N_("Duplicate recording handling."),
1358-
.def.i = DVR_AUTOREC_RECORD_ALL,
1360+
.desc = N_("How to handle duplicate recordings. The 'Use DVR "
1361+
"Configuration' value (the default) inherits the "
1362+
"settings from the assigned DVR configuration"),
1363+
.def.i = DVR_AUTOREC_RECORD_DVR_PROFILE,
13591364
.doc = prop_doc_duplicate_handling,
13601365
.off = offsetof(dvr_autorec_entry_t, dae_record),
13611366
.list = dvr_autorec_entry_class_dedup_list,

‎src/dvr/dvr_config.c‎

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ dvr_config_create(const char *name, const char *uuid, htsmsg_t *conf)
190190
cfg->dvr_autorec_max_count = 50;
191191
cfg->dvr_format_tvmovies_subdir = strdup("tvmovies");
192192
cfg->dvr_format_tvshows_subdir = strdup("tvshows");
193-
cfg->dvr_autorec_dedup = 0;
193+
cfg->dvr_autorec_dedup = DVR_AUTOREC_RECORD_ALL;
194194

195195
/* Muxer config */
196196
cfg->dvr_muxcnf.m_cache = MC_CACHE_SYSTEM;
@@ -843,6 +843,44 @@ dvr_config_entry_class_update_window_list(void *o, const char *lang)
843843
24*3600, 60, lang);
844844
}
845845

846+
static htsmsg_t *
847+
dvr_autorec_entry_class_record_list ( void *o, const char *lang )
848+
{
849+
static const struct strtab tab[] = {
850+
{ N_("Record all"),
851+
DVR_AUTOREC_RECORD_ALL },
852+
{ N_("All: Record if EPG/XMLTV indicates it is a unique programme"),
853+
DVR_AUTOREC_RECORD_UNIQUE },
854+
{ N_("All: Record if different episode number"),
855+
DVR_AUTOREC_RECORD_DIFFERENT_EPISODE_NUMBER },
856+
{ N_("All: Record if different subtitle"),
857+
DVR_AUTOREC_RECORD_DIFFERENT_SUBTITLE },
858+
{ N_("All: Record if different description"),
859+
DVR_AUTOREC_RECORD_DIFFERENT_DESCRIPTION },
860+
{ N_("All: Record once per month"),
861+
DVR_AUTOREC_RECORD_ONCE_PER_MONTH },
862+
{ N_("All: Record once per week"),
863+
DVR_AUTOREC_RECORD_ONCE_PER_WEEK },
864+
{ N_("All: Record once per day"),
865+
DVR_AUTOREC_RECORD_ONCE_PER_DAY },
866+
{ N_("Local: Record if different episode number"),
867+
DVR_AUTOREC_LRECORD_DIFFERENT_EPISODE_NUMBER },
868+
{ N_("Local: Record if different title"),
869+
DVR_AUTOREC_LRECORD_DIFFERENT_TITLE },
870+
{ N_("Local: Record if different subtitle"),
871+
DVR_AUTOREC_LRECORD_DIFFERENT_SUBTITLE },
872+
{ N_("Local: Record if different description"),
873+
DVR_AUTOREC_LRECORD_DIFFERENT_DESCRIPTION },
874+
{ N_("Local: Record once per month"),
875+
DVR_AUTOREC_LRECORD_ONCE_PER_MONTH },
876+
{ N_("Local: Record once per week"),
877+
DVR_AUTOREC_LRECORD_ONCE_PER_WEEK },
878+
{ N_("Local: Record once per day"),
879+
DVR_AUTOREC_LRECORD_ONCE_PER_DAY },
880+
};
881+
return strtab2htsmsg(tab, 1, lang);
882+
}
883+
846884
static int
847885
dvr_config_class_pathname_set(void *o, const void *v)
848886
{
@@ -1428,11 +1466,11 @@ const idclass_t dvr_config_class = {
14281466
.type = PT_U32,
14291467
.id = "record",
14301468
.name = N_("Duplicate handling"),
1431-
.desc = N_("Duplicate recording handling."),
1469+
.desc = N_("How to handle duplicate recordings."),
14321470
.def.i = DVR_AUTOREC_RECORD_ALL,
14331471
.doc = prop_doc_duplicate_handling,
14341472
.off = offsetof(dvr_config_t, dvr_autorec_dedup),
1435-
.list = dvr_autorec_entry_class_dedup_list,
1473+
.list = dvr_autorec_entry_class_record_list,
14361474
.opts = PO_ADVANCED | PO_DOC_NLIST | PO_HIDDEN,
14371475
.group = 6,
14381476
},

‎src/dvr/dvr_db.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1754,7 +1754,10 @@ static dvr_entry_t *_dvr_duplicate_event(dvr_entry_t *de)
17541754
if (lang_str_empty(de->de_title))
17551755
return NULL;
17561756

1757-
record = de->de_autorec->dae_record;
1757+
if (de->de_autorec->dae_record == DVR_AUTOREC_RECORD_DVR_PROFILE)
1758+
record = de->de_config->dvr_autorec_dedup;
1759+
else
1760+
record = de->de_autorec->dae_record;
17581761

17591762
switch (record) {
17601763
case DVR_AUTOREC_RECORD_ALL:

0 commit comments

Comments
 (0)