Project

General

Profile

Bug #179 » issue179.patch

Patch (well, a diff to be exact) - Chris Dekter -, 2011-08-29 13:04

View differences:

src/dvr/dvr.h
258 258

  
259 259
dvr_entry_t *dvr_entry_find_by_event(event_t *e);
260 260

  
261
dvr_entry_t *dvr_entry_find_by_event_fuzzy(event_t *e);
262

  
261 263
off_t dvr_get_filesize(dvr_entry_t *de);
262 264

  
263 265
dvr_entry_t *dvr_entry_cancel(dvr_entry_t *de);
src/dvr/dvr_autorec.c
479 479
dvr_autorec_check_event(event_t *e)
480 480
{
481 481
  dvr_autorec_entry_t *dae;
482
  dvr_entry_t *existingde;
482 483

  
483 484
  TAILQ_FOREACH(dae, &autorec_entries, dae_link)
484
    if(autorec_cmp(dae, e))
485
      dvr_entry_create_by_autorec(e, dae);
485
    if(autorec_cmp(dae, e)) {
486
      existingde = dvr_entry_find_by_event_fuzzy(e);
487
      if (existingde != NULL) {
488
        tvhlog(LOG_DEBUG, "dvr", "Updating existing DVR entry for %s", e->e_title);
489
        dvr_entry_update(existingde, e->e_title, e->e_start, e->e_stop);
490
      } else
491
        dvr_entry_create_by_autorec(e, dae);
492
    }
486 493
}
487 494

  
488 495
/**
src/dvr/dvr_db.c
625 625
  htsp_dvr_entry_update(de);
626 626
  dvr_entry_notify(de);
627 627

  
628

  
629 628
  tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\": Updated Timer", de->de_title, de->de_channel->ch_name);
630 629

  
631 630
  return de;
......
722 721
}
723 722

  
724 723
/**
724
 * Find event with same title starting and ending around same time
725
 * on same channel
726
 */
727
dvr_entry_t *
728
dvr_entry_find_by_event_fuzzy(event_t *e)
729
{
730
  dvr_entry_t *de;
731

  
732
  LIST_FOREACH(de, &e->e_channel->ch_dvrs, de_channel_link)
733
    if(strcmp(de->de_title, e->e_title) == 0) {
734
        if ((abs(de->de_start - e->e_start) < 600) && (abs(de->de_stop - e->e_stop) < 600))
735
           return de;
736
    }
737
  return NULL;
738
}
739

  
740
/**
725 741
 *
726 742
 */
727 743
dvr_entry_t *
(1-1/3)