mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Enhanced the SVDRP command CLRE to allow clearing the EPG data of a particular channel
This commit is contained in:
parent
5e3374539c
commit
dc0665ebf3
@ -2259,3 +2259,7 @@ Istv
|
|||||||
Jiri Dobry <jdobry@centrum.cz>
|
Jiri Dobry <jdobry@centrum.cz>
|
||||||
for reporting a bug in displaying weekday names in the Schedule menu if the system
|
for reporting a bug in displaying weekday names in the Schedule menu if the system
|
||||||
uses UTF-8
|
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
|
||||||
|
2
HISTORY
2
HISTORY
@ -5561,3 +5561,5 @@ Video Disk Recorder Revision History
|
|||||||
- The automatic shutdown is now suppressed if the remote control is currently
|
- The automatic shutdown is now suppressed if the remote control is currently
|
||||||
disabled (suggested by Helmut Auer, implemented by Udo Richter).
|
disabled (suggested by Helmut Auer, implemented by Udo Richter).
|
||||||
- Added a section about "Logging" to PLUGINS.html (suggested by Torsten Kunkel).
|
- 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).
|
||||||
|
56
svdrp.c
56
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.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"
|
#include "svdrp.h"
|
||||||
@ -185,8 +185,9 @@ const char *HelpPages[] = {
|
|||||||
" Switch channel up, down or to the given channel number, name or id.\n"
|
" Switch channel up, down or to the given channel number, name or id.\n"
|
||||||
" Without option (or after successfully switching to the channel)\n"
|
" Without option (or after successfully switching to the channel)\n"
|
||||||
" it returns the current channel number and name.",
|
" it returns the current channel number and name.",
|
||||||
"CLRE\n"
|
"CLRE [ <number> | <name> | <id> ]\n"
|
||||||
" Clear the entire EPG list.",
|
" Clear the EPG list of the given channel number, name or id.\n"
|
||||||
|
" Without option it clears the entire EPG list.",
|
||||||
"DELC <number>\n"
|
"DELC <number>\n"
|
||||||
" Delete channel.",
|
" Delete channel.",
|
||||||
"DELR <number>\n"
|
"DELR <number>\n"
|
||||||
@ -538,9 +539,58 @@ void cSVDRP::CmdCHAN(const char *Option)
|
|||||||
|
|
||||||
void cSVDRP::CmdCLRE(const char *Option)
|
void cSVDRP::CmdCLRE(const char *Option)
|
||||||
{
|
{
|
||||||
|
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();
|
cSchedules::ClearAll();
|
||||||
Reply(250, "EPG data cleared");
|
Reply(250, "EPG data cleared");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cSVDRP::CmdDELC(const char *Option)
|
void cSVDRP::CmdDELC(const char *Option)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user