Merge pull request #43 from thaelim/master
Improved duplicate detection algorithm
This commit is contained in:
commit
9075408185
2 changed files with 16 additions and 10 deletions
|
@ -747,10 +747,14 @@ dvr_entry_t *
|
|||
dvr_entry_find_by_event_fuzzy(event_t *e)
|
||||
{
|
||||
dvr_entry_t *de;
|
||||
|
||||
if (e->e_title == NULL)
|
||||
return NULL;
|
||||
|
||||
LIST_FOREACH(de, &e->e_channel->ch_dvrs, de_channel_link)
|
||||
if (abs(de->de_start - e->e_start) < 600 && abs(de->de_stop - e->e_stop) < 600)
|
||||
return de;
|
||||
if ((abs(de->de_start - e->e_start) < 600) && (abs(de->de_stop - e->e_stop) < 600)) {
|
||||
return de;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
18
src/epg.c
18
src/epg.c
|
@ -458,16 +458,18 @@ epg_erase_duplicates(event_t *e, channel_t *ch) {
|
|||
static int
|
||||
epg_event_cmp_overlap(event_t *e1, event_t *e2)
|
||||
{
|
||||
|
||||
int dur_a, dur_b, mindur;
|
||||
|
||||
if ((e1->e_title == NULL) || (e2->e_title == NULL))
|
||||
return 0;
|
||||
|
||||
if ((e1->e_stop < e2->e_start) || (e2->e_stop < e1->e_start)) {
|
||||
return 0;
|
||||
} else {
|
||||
if ((e1->e_start < e2->e_stop) && (e2->e_start < e1->e_stop)) {
|
||||
if ((e1->e_stop - e2->e_start) > 60 || (e2->e_stop - e1->e_start) > 60)
|
||||
return 1;
|
||||
}
|
||||
|
||||
dur_a = e1->e_stop - e1->e_start;
|
||||
dur_b = e2->e_stop - e2->e_start;
|
||||
mindur = dur_a < dur_b ? dur_a : dur_b;
|
||||
|
||||
if ((abs(e1->e_start - e2->e_start) < mindur) && (abs(e1->e_stop - e2->e_stop) < mindur)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue