Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR: add dedup for different titles
When the autorec rule is using a title regex, it may match
more different episodes identified by the title.
  • Loading branch information
perexg committed Jan 6, 2016
1 parent 1b6413a commit a986924
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/dvr/dvr.h
Expand Up @@ -285,7 +285,8 @@ typedef enum {
DVR_AUTOREC_RECORD_DIFFERENT_SUBTITLE = 2,
DVR_AUTOREC_RECORD_DIFFERENT_DESCRIPTION = 3,
DVR_AUTOREC_RECORD_ONCE_PER_WEEK = 4,
DVR_AUTOREC_RECORD_ONCE_PER_DAY = 5
DVR_AUTOREC_RECORD_ONCE_PER_DAY = 5,
DVR_AUTOREC_RECORD_DIFFERENT_TITLE = 6,
} dvr_autorec_dedup_t;


Expand Down
2 changes: 2 additions & 0 deletions src/dvr/dvr_autorec.c
Expand Up @@ -922,6 +922,8 @@ dvr_autorec_entry_class_dedup_list ( void *o, const char *lang )
DVR_AUTOREC_RECORD_ALL },
{ N_("Record if different episode number"),
DVR_AUTOREC_RECORD_DIFFERENT_EPISODE_NUMBER },
{ N_("Record if different title"),
DVR_AUTOREC_RECORD_DIFFERENT_TITLE },
{ N_("Record if different subtitle"),
DVR_AUTOREC_RECORD_DIFFERENT_SUBTITLE },
{ N_("Record if different description"),
Expand Down
11 changes: 9 additions & 2 deletions src/dvr/dvr_db.c
Expand Up @@ -1063,7 +1063,7 @@ dvr_entry_rerecord(dvr_entry_t *de)
/**
*
*/
static dvr_entry_t *_dvr_duplicate_event(dvr_entry_t* de)
static dvr_entry_t *_dvr_duplicate_event(dvr_entry_t *de)
{
dvr_entry_t *de2;
int record;
Expand All @@ -1080,6 +1080,8 @@ static dvr_entry_t *_dvr_duplicate_event(dvr_entry_t* de)
if (strempty(de->de_episode))
return NULL;
break;
case DVR_AUTOREC_RECORD_DIFFERENT_TITLE:
break;
case DVR_AUTOREC_RECORD_DIFFERENT_SUBTITLE:
if (lang_str_empty(de->de_subtitle))
return NULL;
Expand Down Expand Up @@ -1111,14 +1113,19 @@ static dvr_entry_t *_dvr_duplicate_event(dvr_entry_t* de)
continue;

// if titles are not defined or do not match, don't dedup
if (lang_str_compare(de->de_title, de2->de_title))
if (record != DVR_AUTOREC_RECORD_DIFFERENT_TITLE &&
lang_str_compare(de->de_title, de2->de_title))
continue;

switch (record) {
case DVR_AUTOREC_RECORD_DIFFERENT_EPISODE_NUMBER:
if (!strempty(de2->de_episode) && !strcmp(de->de_episode, de2->de_episode))
return de2;
break;
case DVR_AUTOREC_RECORD_DIFFERENT_TITLE:
if (!lang_str_compare(de->de_title, de2->de_title))
return de2;
break;
case DVR_AUTOREC_RECORD_DIFFERENT_SUBTITLE:
if (!lang_str_compare(de->de_subtitle, de2->de_subtitle))
return de2;
Expand Down

0 comments on commit a986924

Please sign in to comment.