dvr: attempt to stop new DVR code creating false entries

This commit is contained in:
Adam Sutton 2013-04-08 19:38:50 +01:00
parent f9d9bea214
commit 9abf21525a

View file

@ -820,22 +820,32 @@ dvr_event_replaced(epg_broadcast_t *e, epg_broadcast_t *new_e)
de->de_id, epg_broadcast_get_title(e, NULL), e->channel->ch_name,
e->start, e->stop);
/* Ignore - already in progress */
if (de->de_sched_state != DVR_SCHEDULED)
return;
/* Unlink the broadcast */
e->putref(e);
de->de_bcast = NULL;
/* If this was craeted by autorec - just remove it, it'll get recreated */
if (de->de_autorec) {
dvr_entry_remove(de);
/* Find match */
RB_FOREACH(e, &e->channel->ch_epg_schedule, sched_link) {
if (dvr_entry_fuzzy_match(de, e)) {
tvhtrace("dvr",
" replacement event %s on %s @ %"PRItime_t
" to %"PRItime_t,
epg_broadcast_get_title(e, NULL), e->channel->ch_name,
e->start, e->stop);
e->getref(e);
de->de_bcast = e;
_dvr_entry_update(de, e, NULL, NULL, NULL, 0, 0, 0, 0);
break;
} else {
RB_FOREACH(e, &e->channel->ch_epg_schedule, sched_link) {
if (dvr_entry_fuzzy_match(de, e)) {
tvhtrace("dvr",
" replacement event %s on %s @ %"PRItime_t
" to %"PRItime_t,
epg_broadcast_get_title(e, NULL), e->channel->ch_name,
e->start, e->stop);
e->getref(e);
de->de_bcast = e;
_dvr_entry_update(de, e, NULL, NULL, NULL, 0, 0, 0, 0);
break;
}
}
}
}