diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 3.3 2013/12/28 11:33:08 kls Exp $ + * $Id: channels.c 3.4 2014/01/04 15:01:52 kls Exp $ */ #include "channels.h" @@ -64,6 +64,7 @@ cChannel::cChannel(void) memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__); parameters = ""; modification = CHANNELMOD_NONE; + seen = 0; schedule = NULL; linkChannels = NULL; refChannel = NULL; @@ -411,6 +412,11 @@ void cChannel::SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *Compos } } +void cChannel::SetSeen(void) +{ + seen = time(NULL); +} + void cChannel::SetCaIds(const int *CaIds) { if (caids[0] && caids[0] <= CA_USER_MAX) @@ -1019,6 +1025,7 @@ cChannel *cChannels::NewChannel(const cChannel *Transponder, const char *Name, c NewChannel->CopyTransponderData(Transponder); NewChannel->SetId(Nid, Tid, Sid, Rid); NewChannel->SetName(Name, ShortName, Provider); + NewChannel->SetSeen(); Add(NewChannel); ReNumber(); return NewChannel; @@ -1026,6 +1033,19 @@ cChannel *cChannels::NewChannel(const cChannel *Transponder, const char *Name, c return NULL; } +#define CHANNELMARKOBSOLETE "OBSOLETE" +#define CHANNELTIMEOBSOLETE 3600 // seconds to wait before declaring a channel obsolete (in case it has actually been seen before) + +void cChannels::MarkObsoleteChannels(int Source, int Nid, int Tid) +{ + for (cChannel *channel = First(); channel; channel = Next(channel)) { + if (time(NULL) - channel->Seen() > CHANNELTIMEOBSOLETE && channel->Source() == Source && channel->Nid() == Nid && channel->Tid() == Tid) { + if (!endswith(channel->Name(), CHANNELMARKOBSOLETE)) + channel->SetName(cString::sprintf("%s %s", channel->Name(), CHANNELMARKOBSOLETE), channel->ShortName(), cString::sprintf("%s %s", CHANNELMARKOBSOLETE, channel->Provider())); + } + } +} + cString ChannelString(const cChannel *Channel, int Number) { char buffer[256]; |