summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2008-01-13 15:06:25 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2008-01-13 15:06:25 +0100
commitdc0665ebf3c7c814f080e28dbd3b5b6b68c3b56e (patch)
tree9345c08fc86fd068a26b8aba052f26dfa3e83da8
parent5e3374539c08d87abfc55f4878e544e0d4ac3ef6 (diff)
downloadvdr-dc0665ebf3c7c814f080e28dbd3b5b6b68c3b56e.tar.gz
vdr-dc0665ebf3c7c814f080e28dbd3b5b6b68c3b56e.tar.bz2
Enhanced the SVDRP command CLRE to allow clearing the EPG data of a particular channel1.5.13
-rw-r--r--CONTRIBUTORS4
-rw-r--r--HISTORY2
-rw-r--r--svdrp.c60
3 files changed, 61 insertions, 5 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index f45d6219..7f5acb85 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2259,3 +2259,7 @@ István Füley <ifuley@tigercomp.ro>
Jiri Dobry <jdobry@centrum.cz>
for reporting a bug in displaying weekday names in the Schedule menu if the system
uses UTF-8
+
+Benjamin Hess <benjamin.h@gmx.ch>
+ for enhancing the SVDRP command CLRE to allow clearing the EPG data of a particular
+ channel
diff --git a/HISTORY b/HISTORY
index 8d2f256a..3c953253 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5561,3 +5561,5 @@ Video Disk Recorder Revision History
- The automatic shutdown is now suppressed if the remote control is currently
disabled (suggested by Helmut Auer, implemented by Udo Richter).
- Added a section about "Logging" to PLUGINS.html (suggested by Torsten Kunkel).
+- Enhanced the SVDRP command CLRE to allow clearing the EPG data of a particular
+ channel (thanks to Benjamin Hess).
diff --git a/svdrp.c b/svdrp.c
index c8cd5be8..2ac3a4bb 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.104 2007/10/13 10:17:48 kls Exp $
+ * $Id: svdrp.c 1.105 2008/01/13 15:06:25 kls Exp $
*/
#include "svdrp.h"
@@ -185,8 +185,9 @@ const char *HelpPages[] = {
" Switch channel up, down or to the given channel number, name or id.\n"
" Without option (or after successfully switching to the channel)\n"
" it returns the current channel number and name.",
- "CLRE\n"
- " Clear the entire EPG list.",
+ "CLRE [ <number> | <name> | <id> ]\n"
+ " Clear the EPG list of the given channel number, name or id.\n"
+ " Without option it clears the entire EPG list.",
"DELC <number>\n"
" Delete channel.",
"DELR <number>\n"
@@ -538,8 +539,57 @@ void cSVDRP::CmdCHAN(const char *Option)
void cSVDRP::CmdCLRE(const char *Option)
{
- cSchedules::ClearAll();
- Reply(250, "EPG data cleared");
+ if (*Option) {
+ tChannelID ChannelID = tChannelID::InvalidID;
+ if (isnumber(Option)) {
+ int o = strtol(Option, NULL, 10);
+ if (o >= 1 && o <= Channels.MaxNumber())
+ ChannelID = Channels.GetByNumber(o)->GetChannelID();
+ }
+ else {
+ ChannelID = tChannelID::FromString(Option);
+ if (ChannelID == tChannelID::InvalidID) {
+ for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
+ if (!Channel->GroupSep()) {
+ if (strcasecmp(Channel->Name(), Option) == 0) {
+ ChannelID = Channel->GetChannelID();
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!(ChannelID == tChannelID::InvalidID)) {
+ cSchedulesLock SchedulesLock(true, 1000);
+ cSchedules *s = (cSchedules *)cSchedules::Schedules(SchedulesLock);
+ if (s) {
+ cSchedule *Schedule = NULL;
+ ChannelID.ClrRid();
+ for (cSchedule *p = s->First(); p; p = s->Next(p)) {
+ if (p->ChannelID() == ChannelID) {
+ Schedule = p;
+ break;
+ }
+ }
+ if (Schedule) {
+ Schedule->Cleanup(INT_MAX);
+ Reply(250, "EPG data of channel \"%s\" cleared", Option);
+ }
+ else {
+ Reply(550, "No EPG data found for channel \"%s\"", Option);
+ return;
+ }
+ }
+ else
+ Reply(451, "Can't get EPG data");
+ }
+ else
+ Reply(501, "Undefined channel \"%s\"", Option);
+ }
+ else {
+ cSchedules::ClearAll();
+ Reply(250, "EPG data cleared");
+ }
}
void cSVDRP::CmdDELC(const char *Option)