mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
New SVDRP command LSTE to list the EPG data
This commit is contained in:
parent
eb8bd1e754
commit
11eccf850f
1
HISTORY
1
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.
|
||||
|
26
eit.c
26
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 ------------------------------------------------------------------
|
||||
|
8
eit.h
8
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 {
|
||||
|
25
svdrp.c
25
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);
|
||||
|
3
svdrp.h
3
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);
|
||||
|
Loading…
Reference in New Issue
Block a user