summaryrefslogtreecommitdiff
path: root/eit.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-11-26 15:23:39 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2000-11-26 15:23:39 +0100
commitad8610d5d0b78fccdb0576ab49fb84706477cd1e (patch)
tree4389d507bf4285a578f9d767763d8b9d9bbf683f /eit.c
parentc50513accdb3d5d0e5560a4899b1f45569aeb46f (diff)
downloadvdr-ad8610d5d0b78fccdb0576ab49fb84706477cd1e.tar.gz
vdr-ad8610d5d0b78fccdb0576ab49fb84706477cd1e.tar.bz2
Dumping EPG data every ten minutes
Diffstat (limited to 'eit.c')
-rw-r--r--eit.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/eit.c b/eit.c
index 79855282..52dc6618 100644
--- a/eit.c
+++ b/eit.c
@@ -13,7 +13,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: eit.c 1.9 2000/11/18 13:42:28 kls Exp $
+ * $Id: eit.c 1.10 2000/11/25 12:51:06 kls Exp $
***************************************************************************/
#include "eit.h"
@@ -33,6 +33,8 @@
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
+#include "config.h"
+#include "videodir.h"
// --- cMJD ------------------------------------------------------------------
@@ -393,6 +395,21 @@ unsigned short cEventInfo::GetServiceID() const
return uServiceID;
}
+/** */
+void cEventInfo::Dump(FILE *f) const
+{
+ if (tTime + lDuration >= time(NULL)) {
+ fprintf(f, "E %u %ld %ld\n", uEventID, tTime, lDuration);
+ if (!isempty(pTitle))
+ fprintf(f, "T %s\n", pTitle);
+ if (!isempty(pSubtitle))
+ fprintf(f, "S %s\n", pSubtitle);
+ if (!isempty(pExtendedDescription))
+ fprintf(f, "D %s\n", pExtendedDescription);
+ fprintf(f, "e\n");
+ }
+}
+
// --- cSchedule -------------------------------------------------------------
cSchedule::cSchedule(unsigned short servid)
@@ -529,6 +546,19 @@ void cSchedule::Cleanup(time_t tTime)
}
}
+/** */
+void cSchedule::Dump(FILE *f) const
+{
+ cChannel *channel = Channels.GetByServiceID(uServiceID);
+ if (channel)
+ {
+ fprintf(f, "C %u %s\n", uServiceID, channel->name);
+ for (cEventInfo *p = Events.First(); p; p = Events.Next(p))
+ p->Dump(f);
+ fprintf(f, "c\n");
+ }
+}
+
// --- cSchedules ------------------------------------------------------------
cSchedules::cSchedules()
@@ -590,6 +620,13 @@ void cSchedules::Cleanup()
}
}
+/** */
+void cSchedules::Dump(FILE *f) const
+{
+ for (cSchedule *p = First(); p; p = Next(p))
+ p->Dump(f);
+}
+
// --- cEIT ------------------------------------------------------------------
#define DEC(N) dec << setw(N) << setfill(int('0'))
@@ -1105,6 +1142,7 @@ void cSIProcessor::Action()
unsigned int seclen;
unsigned int pid;
time_t lastCleanup = time(NULL);
+ time_t lastDump = time(NULL);
struct pollfd pfd;
while(true)
@@ -1123,6 +1161,19 @@ void cSIProcessor::Action()
schedulesMutex.Unlock();
lastCleanup = now;
}
+ if (now - lastDump > 600)
+ {
+ LOCK_THREAD;
+
+ schedulesMutex.Lock();
+ FILE *f = fopen(AddDirectory(VideoDirectory, "epg.data"), "w");
+ if (f) {
+ schedules->Dump(f);
+ fclose(f);
+ }
+ lastDump = now;
+ schedulesMutex.Unlock();
+ }
}
/* wait data become ready from the bitfilter */
@@ -1283,4 +1334,3 @@ bool cSIProcessor::RefreshFilters()
return ret;
}
-