]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: attempt to stop new DVR code creating false entries
authorAdam Sutton <dev@adamsutton.me.uk>
Mon, 8 Apr 2013 18:38:50 +0000 (19:38 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Wed, 10 Apr 2013 10:45:32 +0000 (11:45 +0100)
src/dvr/dvr_db.c

index 4e5774999bbb4aa7a74e80335e8e94c565e72d1f..d6a1562ca7b8a8dfccdff02850d477973814588d 100644 (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;
+        }
       }
     }
   }