diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2013-09-01 09:20:07 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2013-09-01 09:20:07 +0200 |
commit | c169e2014130b9b082586bacecdf1377f7bb0f22 (patch) | |
tree | 7c2bb27f7815c50ddba6da011f0363b862b1421f /epg.c | |
parent | c3a3b70fa04a4c4d73367c4831b8094cc65b4ec6 (diff) | |
download | vdr-c169e2014130b9b082586bacecdf1377f7bb0f22.tar.gz vdr-c169e2014130b9b082586bacecdf1377f7bb0f22.tar.bz2 |
Fixed cleaning up old EPG events in case no epg data file is given2.0.3
Diffstat (limited to 'epg.c')
-rw-r--r-- | epg.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * - * $Id: epg.c 2.23 2013/02/17 14:12:07 kls Exp $ + * $Id: epg.c 2.23.1.1 2013/09/01 09:16:53 kls Exp $ */ #include "epg.h" @@ -1140,16 +1140,19 @@ bool cSchedule::Read(FILE *f, cSchedules *Schedules) class cEpgDataWriter : public cThread { private: cMutex mutex; + bool dump; protected: virtual void Action(void); public: cEpgDataWriter(void); + void SetDump(bool Dump) { dump = Dump; } void Perform(void); }; cEpgDataWriter::cEpgDataWriter(void) :cThread("epg data writer", true) { + dump = false; } void cEpgDataWriter::Action(void) @@ -1169,7 +1172,8 @@ void cEpgDataWriter::Perform(void) p->Cleanup(now); } } - cSchedules::Dump(); + if (dump) + cSchedules::Dump(); } static cEpgDataWriter EpgDataWriter; @@ -1203,6 +1207,7 @@ void cSchedules::SetEpgDataFileName(const char *FileName) { free(epgDataFileName); epgDataFileName = FileName ? strdup(FileName) : NULL; + EpgDataWriter.SetDump(epgDataFileName != NULL); } void cSchedules::SetModified(cSchedule *Schedule) @@ -1217,12 +1222,10 @@ void cSchedules::Cleanup(bool Force) lastDump = 0; time_t now = time(NULL); if (now - lastDump > EPGDATAWRITEDELTA) { - if (epgDataFileName) { - if (Force) - EpgDataWriter.Perform(); - else if (!EpgDataWriter.Active()) - EpgDataWriter.Start(); - } + if (Force) + EpgDataWriter.Perform(); + else if (!EpgDataWriter.Active()) + EpgDataWriter.Start(); lastDump = now; } } |