From c7bb8d4f334000a7bb9f2824af16bf5b80993147 Mon Sep 17 00:00:00 2001 From: Dave Date: Sun, 8 Jul 2012 10:58:40 +0100 Subject: Delete any remaining timers when deleting a series link. --- README | 18 +++++++++++------- TODO | 2 ++ vdrtva.c | 24 ++++++++++++++++++++++++ vdrtva.h | 1 + 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/README b/README index 0da5804..a050112 100644 --- a/README +++ b/README @@ -94,21 +94,25 @@ address daily. The plugin has an SVDRP interface which is mainly used for debugging, but could be used to interface with other applications. The commands are: -LLOG Print the pending log report +DELL Delete a series link and any timers by series CRID -LSTL Print the series links list +LLOG Print the pending log report -LSTS Print the 'suggested' events list +LSTL Print the series links list -LSTY Print the CRIDs for each event +LSTS Print the 'suggested' events list -LSTZ Print the Default Authority data for each channel +LSTY Print the CRIDs for each event -STOP Start and stop CRID data capture +LSTZ Print the Default Authority data for each channel + +STOP Start and stop CRID data capture STRT -UPDT Trigger an update of the series links. +UPDT Trigger an update of the series links. + +Files The plugin stores details of series links in the file links.data which is in the VIDEODIR/plugins directory. Entries in this file have the format: diff --git a/TODO b/TODO index 30a91a1..d343fb5 100644 --- a/TODO +++ b/TODO @@ -16,6 +16,8 @@ OSD for managing series links (work in progress). Option to select which device to use for CRID collection. +Remove reliance on VDR "Housekeeping" callback - causes problems when VDR is busy. + Bugs: Very rare crash 'pure virtual method called' in plugin - possibly solved. Spurious timer clash report - seen once, cause unknown. diff --git a/vdrtva.c b/vdrtva.c index 0884de7..c4b696f 100644 --- a/vdrtva.c +++ b/vdrtva.c @@ -1489,6 +1489,7 @@ bool cLinks::DeleteItem(const char *sCRID) while (Item) { cLinkItem *next = Next(Item); if (!strcmp(Item->sCRID(), sCRID)) { + DeleteTimersForSCRID(sCRID); Del(Item); maxNumber--; dirty = true; @@ -1499,6 +1500,29 @@ bool cLinks::DeleteItem(const char *sCRID) return false; } +void cLinks::DeleteTimersForSCRID(const char *sCRID) +{ + if ((Timers.Count() == 0) || (!captureComplete)) return; + cTimer *ti = Timers.First(); + while (ti) { + cTimer *next = Timers.Next(ti); + const cEvent *event = ti->Event(); + if (event && ti->HasFlags(tfActive) && (ti->WeekDays() == 0)) { + cChannel *channel = Channels.GetByChannelID(event->ChannelID()); + cChanDA *chanda = ChanDAs.GetByChannelID(channel->Number()); + cEventCRID *eventcrid = EventCRIDs.GetByID(channel->Number(), event->EventID()); + if (eventcrid && chanda) { + cString scrid = cString::sprintf("%s%s", chanda->DA(),eventcrid->sCRID()); + if (!strcmp(scrid, sCRID)) { + isyslog ("vdrtva: deleting timer '%s' from deleted series %s", ti->File(), sCRID); + Timers.Del(ti); + } + } + } + ti = next; + } +} + void cLinks::Expire(void) { if (maxNumber == 0) return; diff --git a/vdrtva.h b/vdrtva.h index 76f42e5..c824db6 100644 --- a/vdrtva.h +++ b/vdrtva.h @@ -193,4 +193,5 @@ class cLinks : public cRwLock, public cConfig { bool DeleteItem(const char *sCRID); void Expire(void); void SetUpdated(void); + void DeleteTimersForSCRID(const char *sCRID); }; -- cgit v1.2.3