diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2014-01-05 10:41:46 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2014-01-05 10:41:46 +0100 |
commit | c7256c1c1123f2222c6b272af6472bc568b7d2ec (patch) | |
tree | cad2b286deaea4a2c574f7caae74a03231300ac5 /channels.c | |
parent | 7cbced0c124a2d03290d82953c09f199602b1f7f (diff) | |
download | vdr-c7256c1c1123f2222c6b272af6472bc568b7d2ec.tar.gz vdr-c7256c1c1123f2222c6b272af6472bc568b7d2ec.tar.bz2 |
Channels that are no longer contained in the current SDT of a transponder are now marked with the keyword OBSOLETE in their name and provider fields2.1.3
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]; |