mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Extended the SVDRP command LSTE to allow limiting the listed data
This commit is contained in:
parent
98f3934a58
commit
36e22ad6e2
@ -279,6 +279,8 @@ Andy Grobb <Charly98@01019freenet.de>
|
|||||||
Thomas Heiligenmann <thomas@heiligenmann.de>
|
Thomas Heiligenmann <thomas@heiligenmann.de>
|
||||||
for implementing the SVDRP commands LSTR and DELR
|
for implementing the SVDRP commands LSTR and DELR
|
||||||
for adding MPEG1 handling to cDvbDevice::StillPicture()
|
for adding MPEG1 handling to cDvbDevice::StillPicture()
|
||||||
|
for extending the SVDRP command LSTE to allow limiting the listed data to a given
|
||||||
|
channel, the present or following events, or events at a given time
|
||||||
|
|
||||||
Norbert Schmidt <nschmidt-nrw@t-online.de>
|
Norbert Schmidt <nschmidt-nrw@t-online.de>
|
||||||
for filling in some missing teletext PIDs
|
for filling in some missing teletext PIDs
|
||||||
|
3
HISTORY
3
HISTORY
@ -2696,3 +2696,6 @@ Video Disk Recorder Revision History
|
|||||||
in preparation for full VPS support for timers (provided the tv stations
|
in preparation for full VPS support for timers (provided the tv stations
|
||||||
actually broadcast this information). Currently these are just displayed in
|
actually broadcast this information). Currently these are just displayed in
|
||||||
the event page if they exist and are different than the event's start time.
|
the event page if they exist and are different than the event's start time.
|
||||||
|
- Extended the SVDRP command LSTE to allow limiting the listed data to a given
|
||||||
|
channel, the present or following events, or events at a given time (thanks to
|
||||||
|
Thomas Heiligenmann).
|
||||||
|
31
epg.c
31
epg.c
@ -7,7 +7,7 @@
|
|||||||
* Original version (as used in VDR before 1.3.0) written by
|
* Original version (as used in VDR before 1.3.0) written by
|
||||||
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
||||||
*
|
*
|
||||||
* $Id: epg.c 1.12 2004/02/22 13:55:12 kls Exp $
|
* $Id: epg.c 1.13 2004/02/22 14:41:37 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "epg.h"
|
#include "epg.h"
|
||||||
@ -552,13 +552,34 @@ void cSchedule::Cleanup(time_t Time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSchedule::Dump(FILE *f, const char *Prefix) const
|
void cSchedule::Dump(FILE *f, const char *Prefix, eDumpMode DumpMode, time_t AtTime) const
|
||||||
{
|
{
|
||||||
cChannel *channel = Channels.GetByChannelID(channelID, true);
|
cChannel *channel = Channels.GetByChannelID(channelID, true);
|
||||||
if (channel) {
|
if (channel) {
|
||||||
fprintf(f, "%sC %s %s\n", Prefix, channel->GetChannelID().ToString(), channel->Name());
|
fprintf(f, "%sC %s %s\n", Prefix, channel->GetChannelID().ToString(), channel->Name());
|
||||||
for (cEvent *p = events.First(); p; p = events.Next(p))
|
const cEvent *p;
|
||||||
|
switch (DumpMode) {
|
||||||
|
case dmAll: {
|
||||||
|
for (p = events.First(); p; p = events.Next(p))
|
||||||
p->Dump(f, Prefix);
|
p->Dump(f, Prefix);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case dmPresent: {
|
||||||
|
if ((p = GetPresentEvent()) != NULL)
|
||||||
|
p->Dump(f, Prefix);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case dmFollowing: {
|
||||||
|
if ((p = GetFollowingEvent()) != NULL)
|
||||||
|
p->Dump(f, Prefix);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case dmAtTime: {
|
||||||
|
if ((p = GetEventAround(AtTime)) != NULL)
|
||||||
|
p->Dump(f, Prefix);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
fprintf(f, "%sc\n", Prefix);
|
fprintf(f, "%sc\n", Prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -682,13 +703,13 @@ bool cSchedules::ClearAll(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSchedules::Dump(FILE *f, const char *Prefix)
|
bool cSchedules::Dump(FILE *f, const char *Prefix, eDumpMode DumpMode, time_t AtTime)
|
||||||
{
|
{
|
||||||
cSchedulesLock SchedulesLock;
|
cSchedulesLock SchedulesLock;
|
||||||
cSchedules *s = (cSchedules *)Schedules(SchedulesLock);
|
cSchedules *s = (cSchedules *)Schedules(SchedulesLock);
|
||||||
if (s) {
|
if (s) {
|
||||||
for (cSchedule *p = s->First(); p; p = s->Next(p))
|
for (cSchedule *p = s->First(); p; p = s->Next(p))
|
||||||
p->Dump(f, Prefix);
|
p->Dump(f, Prefix, DumpMode, AtTime);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
8
epg.h
8
epg.h
@ -7,7 +7,7 @@
|
|||||||
* Original version (as used in VDR before 1.3.0) written by
|
* Original version (as used in VDR before 1.3.0) written by
|
||||||
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
||||||
*
|
*
|
||||||
* $Id: epg.h 1.9 2004/02/22 13:52:46 kls Exp $
|
* $Id: epg.h 1.10 2004/02/22 14:34:04 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __EPG_H
|
#ifndef __EPG_H
|
||||||
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#define MAXEPGBUGFIXLEVEL 2
|
#define MAXEPGBUGFIXLEVEL 2
|
||||||
|
|
||||||
|
enum eDumpMode { dmAll, dmPresent, dmFollowing, dmAtTime };
|
||||||
|
|
||||||
class cSchedule;
|
class cSchedule;
|
||||||
|
|
||||||
class cEvent : public cListObject {
|
class cEvent : public cListObject {
|
||||||
@ -89,7 +91,7 @@ public:
|
|||||||
const cEvent *GetEventAround(time_t Time) const;
|
const cEvent *GetEventAround(time_t Time) const;
|
||||||
const cEvent *GetEventNumber(int n) const { return events.Get(n); }
|
const cEvent *GetEventNumber(int n) const { return events.Get(n); }
|
||||||
int NumEvents(void) const { return events.Count(); }
|
int NumEvents(void) const { return events.Count(); }
|
||||||
void Dump(FILE *f, const char *Prefix = "") const;
|
void Dump(FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0) const;
|
||||||
static bool Read(FILE *f, cSchedules *Schedules);
|
static bool Read(FILE *f, cSchedules *Schedules);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,7 +122,7 @@ public:
|
|||||||
static void Cleanup(bool Force = false);
|
static void Cleanup(bool Force = false);
|
||||||
static void ResetVersions(void);
|
static void ResetVersions(void);
|
||||||
static bool ClearAll(void);
|
static bool ClearAll(void);
|
||||||
static bool Dump(FILE *f, const char *Prefix = "");
|
static bool Dump(FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0);
|
||||||
static bool Read(FILE *f = NULL);
|
static bool Read(FILE *f = NULL);
|
||||||
cSchedule *AddSchedule(tChannelID ChannelID);
|
cSchedule *AddSchedule(tChannelID ChannelID);
|
||||||
const cSchedule *GetSchedule(tChannelID ChannelID) const;
|
const cSchedule *GetSchedule(tChannelID ChannelID) const;
|
||||||
|
70
svdrp.c
70
svdrp.c
@ -10,7 +10,7 @@
|
|||||||
* and interact with the Video Disk Recorder - or write a full featured
|
* and interact with the Video Disk Recorder - or write a full featured
|
||||||
* graphical interface that sits on top of an SVDRP connection.
|
* graphical interface that sits on top of an SVDRP connection.
|
||||||
*
|
*
|
||||||
* $Id: svdrp.c 1.59 2004/01/31 10:13:50 kls Exp $
|
* $Id: svdrp.c 1.60 2004/02/22 15:31:23 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "svdrp.h"
|
#include "svdrp.h"
|
||||||
@ -205,8 +205,12 @@ const char *HelpPages[] = {
|
|||||||
" List channels. Without option, all channels are listed. Otherwise\n"
|
" List channels. Without option, all channels are listed. Otherwise\n"
|
||||||
" only the given channel is listed. If a name is given, all channels\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.",
|
" containing the given string as part of their name are listed.",
|
||||||
"LSTE\n"
|
"LSTE [ <channel> ] [ now | next | at <time> ]\n"
|
||||||
" List EPG data.",
|
" List EPG data. Without any parameters all data of all channels is\n"
|
||||||
|
" listed. If a channel is given (either by number of by channel ID),\n",
|
||||||
|
" only data for that channel is listed. 'now', 'next', or 'at <time>'\n"
|
||||||
|
" restricts the returned data to present events, following events, or\n"
|
||||||
|
" events at the given time (which must be in time_t form)."
|
||||||
"LSTR [ <number> ]\n"
|
"LSTR [ <number> ]\n"
|
||||||
" List recordings. Without option, all recordings are listed. Otherwise\n"
|
" List recordings. Without option, all recordings are listed. Otherwise\n"
|
||||||
" the summary for the given recording is listed.",
|
" the summary for the given recording is listed.",
|
||||||
@ -714,9 +718,65 @@ void cSVDRP::CmdLSTE(const char *Option)
|
|||||||
cSchedulesLock SchedulesLock;
|
cSchedulesLock SchedulesLock;
|
||||||
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
|
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
|
||||||
if (Schedules) {
|
if (Schedules) {
|
||||||
|
const cSchedule* Schedule = NULL;
|
||||||
|
eDumpMode DumpMode = dmAll;
|
||||||
|
time_t AtTime = 0;
|
||||||
|
if (*Option) {
|
||||||
|
char buf[strlen(Option) + 1];
|
||||||
|
strcpy(buf, Option);
|
||||||
|
const char *delim = " \t";
|
||||||
|
char *p = strtok(buf, delim);
|
||||||
|
while (p && DumpMode == dmAll) {
|
||||||
|
if (strcasecmp(p, "NOW") == 0)
|
||||||
|
DumpMode = dmPresent;
|
||||||
|
else if (strcasecmp(p, "NEXT") == 0)
|
||||||
|
DumpMode = dmFollowing;
|
||||||
|
else if (strcasecmp(p, "AT") == 0) {
|
||||||
|
DumpMode = dmAtTime;
|
||||||
|
if ((p = strtok(NULL, delim)) != NULL) {
|
||||||
|
if (isnumber(p))
|
||||||
|
AtTime = strtol(p, NULL, 10);
|
||||||
|
else {
|
||||||
|
Reply(501, "Invalid time");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Reply(501, "Missing time");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!Schedule) {
|
||||||
|
cChannel* Channel = NULL;
|
||||||
|
if (isnumber(p))
|
||||||
|
Channel = Channels.GetByNumber(strtol(Option, NULL, 10));
|
||||||
|
else
|
||||||
|
Channel = Channels.GetByChannelID(tChannelID::FromString(Option));
|
||||||
|
if (Channel) {
|
||||||
|
Schedule = Schedules->GetSchedule(Channel->GetChannelID());
|
||||||
|
if (!Schedule) {
|
||||||
|
Reply(550, "No schedule found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Reply(550, "Channel \"%s\" not defined", p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Reply(501, "Unknown option: \"%s\"", p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p = strtok(NULL, delim);
|
||||||
|
}
|
||||||
|
}
|
||||||
FILE *f = fdopen(file, "w");
|
FILE *f = fdopen(file, "w");
|
||||||
if (f) {
|
if (f) {
|
||||||
Schedules->Dump(f, "215-");
|
if (Schedule)
|
||||||
|
Schedule->Dump(f, "215-", DumpMode, AtTime);
|
||||||
|
else
|
||||||
|
Schedules->Dump(f, "215-", DumpMode, AtTime);
|
||||||
fflush(f);
|
fflush(f);
|
||||||
Reply(215, "End of EPG data");
|
Reply(215, "End of EPG data");
|
||||||
// don't 'fclose(f)' here!
|
// don't 'fclose(f)' here!
|
||||||
@ -741,7 +801,7 @@ void cSVDRP::CmdLSTR(const char *Option)
|
|||||||
free(summary);
|
free(summary);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Reply(550, "No summary availabe");
|
Reply(550, "No summary available");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Reply(550, "Recording \"%s\" not found", Option);
|
Reply(550, "Recording \"%s\" not found", Option);
|
||||||
|
Loading…
Reference in New Issue
Block a user