summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY3
-rw-r--r--svdrp.c79
3 files changed, 43 insertions, 40 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 3d6f3e97..4107407a 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2918,6 +2918,7 @@ Manuel Reimer <Manuel.Reimer@gmx.de>
when switching to a less privileged user id
for reporting a bug in moving channels between number groups in SVDRP's MOVC command
for fixing compatibility with current versions of glibc
+ for suggesting to make the SVDRP command DELC accept a channel id
Rene van den Braken <rene@vandenbraken.name>
for reporting a bug in writing the PCR pid into the PMT in
diff --git a/HISTORY b/HISTORY
index b67ce0d6..b05d449b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -9420,7 +9420,7 @@ Video Disk Recorder Revision History
- Fixed handling the S2SatelliteDeliverySystemDescriptor for transponders broadcasting
in "backwards compatibility mode" according to ETSI EN 300 468 (thanks to Onur Sentürk).
-2020-05-04:
+2020-05-05:
- Fixed moving channels between number groups in SVDRP's MOVC command and the Channels
menu, in case a channel is moved to a higher number and into a numbered group
@@ -9429,3 +9429,4 @@ Video Disk Recorder Revision History
for NID and TID (thanks to Uwe Scheffler for reporting a problem with failed tuning
in SCR systems, and Helmut Binder for helping with the implementation).
- Fixed compatibility with current versions of glibc (thanks to Manuel Reimer).
+- The SVDRP command DELC now also accepts a channel id (suggested by Manuel Reimer).
diff --git a/svdrp.c b/svdrp.c
index 46bd9a1a..26b22167 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 4.40 2020/04/11 09:22:05 kls Exp $
+ * $Id: svdrp.c 4.41 2020/05/05 15:37:49 kls Exp $
*/
#include "svdrp.h"
@@ -840,8 +840,8 @@ const char *HelpPages[] = {
" Used by peer-to-peer connections between VDRs to tell the other VDR\n"
" to establish a connection to this VDR. The name is the SVDRP host name\n"
" of this VDR, which may differ from its DNS name.",
- "DELC <number>\n"
- " Delete channel.",
+ "DELC <number> | <id>\n"
+ " Delete the channel with the given number or channel id.",
"DELR <id>\n"
" Delete the recording with the given id. Before a recording can be\n"
" deleted, an LSTR command should have been executed in order to retrieve\n"
@@ -1379,49 +1379,50 @@ void cSVDRPServer::CmdCONN(const char *Option)
void cSVDRPServer::CmdDELC(const char *Option)
{
if (*Option) {
- if (isnumber(Option)) {
- LOCK_TIMERS_READ;
- LOCK_CHANNELS_WRITE;
- Channels->SetExplicitModify();
- if (cChannel *Channel = Channels->GetByNumber(strtol(Option, NULL, 10))) {
- if (const cTimer *Timer = Timers->UsesChannel(Channel)) {
- Reply(550, "Channel \"%s\" is in use by timer %s", Option, *Timer->ToDescr());
+ LOCK_TIMERS_READ;
+ LOCK_CHANNELS_WRITE;
+ Channels->SetExplicitModify();
+ cChannel *Channel = NULL;
+ if (isnumber(Option))
+ Channel = Channels->GetByNumber(strtol(Option, NULL, 10));
+ else
+ Channel = Channels->GetByChannelID(tChannelID::FromString(Option));
+ if (Channel) {
+ if (const cTimer *Timer = Timers->UsesChannel(Channel)) {
+ Reply(550, "Channel \"%s\" is in use by timer %s", Option, *Timer->ToDescr());
+ return;
+ }
+ int CurrentChannelNr = cDevice::CurrentChannel();
+ cChannel *CurrentChannel = Channels->GetByNumber(CurrentChannelNr);
+ if (CurrentChannel && Channel == CurrentChannel) {
+ int n = Channels->GetNextNormal(CurrentChannel->Index());
+ if (n < 0)
+ n = Channels->GetPrevNormal(CurrentChannel->Index());
+ if (n < 0) {
+ Reply(501, "Can't delete channel \"%s\" - list would be empty", Option);
return;
}
- int CurrentChannelNr = cDevice::CurrentChannel();
- cChannel *CurrentChannel = Channels->GetByNumber(CurrentChannelNr);
- if (CurrentChannel && Channel == CurrentChannel) {
- int n = Channels->GetNextNormal(CurrentChannel->Index());
- if (n < 0)
- n = Channels->GetPrevNormal(CurrentChannel->Index());
- if (n < 0) {
- Reply(501, "Can't delete channel \"%s\" - list would be empty", Option);
- return;
- }
- CurrentChannel = Channels->Get(n);
- CurrentChannelNr = 0; // triggers channel switch below
- }
- Channels->Del(Channel);
- Channels->ReNumber();
- Channels->SetModifiedByUser();
- Channels->SetModified();
- isyslog("SVDRP %s < %s deleted channel %s", Setup.SVDRPHostName, *clientName, Option);
- if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) {
- if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring())
- Channels->SwitchTo(CurrentChannel->Number());
- else
- cDevice::SetCurrentChannel(CurrentChannel->Number());
- }
- Reply(250, "Channel \"%s\" deleted", Option);
+ CurrentChannel = Channels->Get(n);
+ CurrentChannelNr = 0; // triggers channel switch below
}
- else
- Reply(501, "Channel \"%s\" not defined", Option);
+ Channels->Del(Channel);
+ Channels->ReNumber();
+ Channels->SetModifiedByUser();
+ Channels->SetModified();
+ isyslog("SVDRP %s < %s deleted channel %s", Setup.SVDRPHostName, *clientName, Option);
+ if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) {
+ if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring())
+ Channels->SwitchTo(CurrentChannel->Number());
+ else
+ cDevice::SetCurrentChannel(CurrentChannel->Number());
+ }
+ Reply(250, "Channel \"%s\" deleted", Option);
}
else
- Reply(501, "Error in channel number \"%s\"", Option);
+ Reply(501, "Channel \"%s\" not defined", Option);
}
else
- Reply(501, "Missing channel number");
+ Reply(501, "Missing channel number or id");
}
static cString RecordingInUseMessage(int Reason, const char *RecordingId, cRecording *Recording)