summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--eit.c26
-rw-r--r--eit.h8
-rw-r--r--svdrp.c25
-rw-r--r--svdrp.h3
5 files changed, 44 insertions, 19 deletions
diff --git a/HISTORY b/HISTORY
index bcfa549a..2906fa33 100644
--- a/HISTORY
+++ b/HISTORY
@@ -450,3 +450,4 @@ Video Disk Recorder Revision History
- SVDRP now also works with clients that don't do line buffering (like the
Windows 'telnet').
- Empty lines in config files no longer cause error messages.
+- New SVDRP command LSTE to list the EPG data.
diff --git a/eit.c b/eit.c
index e80cd61f..6cbe504d 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.14 2001/03/31 15:03:16 kls Exp $
+ * $Id: eit.c 1.15 2001/04/01 15:36:09 kls Exp $
***************************************************************************/
#include "eit.h"
@@ -395,17 +395,17 @@ unsigned short cEventInfo::GetServiceID() const
}
/** */
-void cEventInfo::Dump(FILE *f) const
+void cEventInfo::Dump(FILE *f, const char *Prefix) const
{
if (tTime + lDuration >= time(NULL)) {
- fprintf(f, "E %u %ld %ld\n", uEventID, tTime, lDuration);
+ fprintf(f, "%sE %u %ld %ld\n", Prefix, uEventID, tTime, lDuration);
if (!isempty(pTitle))
- fprintf(f, "T %s\n", pTitle);
+ fprintf(f, "%sT %s\n", Prefix, pTitle);
if (!isempty(pSubtitle))
- fprintf(f, "S %s\n", pSubtitle);
+ fprintf(f, "%sS %s\n", Prefix, pSubtitle);
if (!isempty(pExtendedDescription))
- fprintf(f, "D %s\n", pExtendedDescription);
- fprintf(f, "e\n");
+ fprintf(f, "%sD %s\n", Prefix, pExtendedDescription);
+ fprintf(f, "%se\n", Prefix);
}
}
@@ -546,15 +546,15 @@ void cSchedule::Cleanup(time_t tTime)
}
/** */
-void cSchedule::Dump(FILE *f) const
+void cSchedule::Dump(FILE *f, const char *Prefix) const
{
cChannel *channel = Channels.GetByServiceID(uServiceID);
if (channel)
{
- fprintf(f, "C %u %s\n", uServiceID, channel->name);
+ fprintf(f, "%sC %u %s\n", Prefix, uServiceID, channel->name);
for (cEventInfo *p = Events.First(); p; p = Events.Next(p))
- p->Dump(f);
- fprintf(f, "c\n");
+ p->Dump(f, Prefix);
+ fprintf(f, "%sc\n", Prefix);
}
}
@@ -620,10 +620,10 @@ void cSchedules::Cleanup()
}
/** */
-void cSchedules::Dump(FILE *f) const
+void cSchedules::Dump(FILE *f, const char *Prefix) const
{
for (cSchedule *p = First(); p; p = Next(p))
- p->Dump(f);
+ p->Dump(f, Prefix);
}
// --- cEIT ------------------------------------------------------------------
diff --git a/eit.h b/eit.h
index 974fa7bd..3d491935 100644
--- a/eit.h
+++ b/eit.h
@@ -13,7 +13,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: eit.h 1.5 2001/03/31 12:42:52 kls Exp $
+ * $Id: eit.h 1.6 2001/04/01 15:14:12 kls Exp $
***************************************************************************/
#ifndef __EIT_H
@@ -66,7 +66,7 @@ public:
unsigned short GetServiceID(void) const;
int GetChannelNumber(void) const { return nChannelNumber; }
void SetChannelNumber(int ChannelNumber) const { ((cEventInfo *)this)->nChannelNumber = ChannelNumber; } // doesn't modify the EIT data, so it's ok to make it 'const'
- void Dump(FILE *f) const;
+ void Dump(FILE *f, const char *Prefix = "") const;
};
class cSchedule : public cListObject {
@@ -93,7 +93,7 @@ public:
const cEventInfo *GetEvent(time_t tTime) const;
const cEventInfo *GetEventNumber(int n) const { return Events.Get(n); }
int NumEvents(void) const { return Events.Count(); }
- void Dump(FILE *f) const;
+ void Dump(FILE *f, const char *Prefix = "") const;
};
class cSchedules : public cList<cSchedule> {
@@ -109,7 +109,7 @@ public:
~cSchedules();
const cSchedule *GetSchedule(unsigned short servid) const;
const cSchedule *GetSchedule(void) const;
- void Dump(FILE *f) const;
+ void Dump(FILE *f, const char *Prefix = "") const;
};
typedef struct sip_filter {
diff --git a/svdrp.c b/svdrp.c
index 941685f0..cd4a143d 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 1.16 2001/04/01 14:09:29 kls Exp $
+ * $Id: svdrp.c 1.17 2001/04/01 15:38:49 kls Exp $
*/
#define _GNU_SOURCE
@@ -137,6 +137,8 @@ const char *HelpPages[] = {
" List channels. Without option, all channels are listed. Otherwise\n"
" only the given channel is listed. If a name is given, all channels\n"
" containing the given string as part of their name are listed.",
+ "LSTE\n"
+ " List EPG data.",
"LSTT [ <number> ]\n"
" List timers. Without option, all timers are listed. Otherwise\n"
" only the given timer is listed.",
@@ -187,6 +189,7 @@ const char *HelpPages[] = {
/* SVDRP Reply Codes:
214 Help message
+ 215 EPG data record
220 VDR service ready
221 VDR service closing transmission channel
250 Requested VDR action okay, completed
@@ -548,6 +551,25 @@ void cSVDRP::CmdLSTC(const char *Option)
Reply(550, "No channels defined");
}
+void cSVDRP::CmdLSTE(const char *Option)
+{
+ cThreadLock ThreadLock;
+ const cSchedules *Schedules = cDvbApi::PrimaryDvbApi->Schedules(&ThreadLock);
+ if (Schedules) {
+ FILE *f = fdopen(file, "w");
+ if (f) {
+ Schedules->Dump(f, "215-");
+ fflush(f);
+ Reply(215, "End of EPG data");
+ // don't 'fclose(f)' here!
+ }
+ else
+ Reply(451, "Can't open file connection");
+ }
+ else
+ Reply(451, "Can't get EPG data");
+}
+
void cSVDRP::CmdLSTT(const char *Option)
{
if (*Option) {
@@ -851,6 +873,7 @@ void cSVDRP::Execute(char *Cmd)
else if (CMD("HELP")) CmdHELP(s);
else if (CMD("HITK")) CmdHITK(s);
else if (CMD("LSTC")) CmdLSTC(s);
+ else if (CMD("LSTE")) CmdLSTE(s);
else if (CMD("LSTT")) CmdLSTT(s);
else if (CMD("MESG")) CmdMESG(s);
else if (CMD("MODC")) CmdMODC(s);
diff --git a/svdrp.h b/svdrp.h
index 794d8be2..83827082 100644
--- a/svdrp.h
+++ b/svdrp.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: svdrp.h 1.8 2001/04/01 14:10:33 kls Exp $
+ * $Id: svdrp.h 1.9 2001/04/01 15:05:38 kls Exp $
*/
#ifndef __SVDRP_H
@@ -47,6 +47,7 @@ private:
void CmdHELP(const char *Option);
void CmdHITK(const char *Option);
void CmdLSTC(const char *Option);
+ void CmdLSTE(const char *Option);
void CmdLSTT(const char *Option);
void CmdMESG(const char *Option);
void CmdMODC(const char *Option);