1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Now checking whether timers or channels are currently being edited via the menu before making changes through SVDRP

This commit is contained in:
Klaus Schmidinger 2005-07-31 14:34:38 +02:00
parent d6b8a28329
commit 068e17303c
3 changed files with 93 additions and 68 deletions

View File

@ -1271,12 +1271,14 @@ Joachim Wilke <vdr@joachim-wilke.de>
for reporting missing calls to cStatus::MsgOsdClear() in cSkins::Message() for reporting missing calls to cStatus::MsgOsdClear() in cSkins::Message()
Sascha Klek <sklek@gmx.de> Sascha Klek <sklek@gmx.de>
for reporting a problem with the '0' key in the "Day" item of the "Timers" menu for reporting a problem with the '0' key in the "Day" item of the "Timers" menu
Andreas Brugger <brougs78@gmx.net> Andreas Brugger <brougs78@gmx.net>
for reporting a possible crash when pausing live video and the recording was for reporting a possible crash when pausing live video and the recording was
unable to start, maybe because there was no lock on the device unable to start, maybe because there was no lock on the device
for reporting the missing Euro sign in iso8859-1 for reporting the missing Euro sign in iso8859-1
for reporting a problem with making changes to timers through SVDRP while they
are being edited via the menu
Dino Ravnic <dino.ravnic@fer.hr> Dino Ravnic <dino.ravnic@fer.hr>
for fixing some characters in the iso8859-2 font file for fixing some characters in the iso8859-2 font file

View File

@ -3650,3 +3650,6 @@ Video Disk Recorder Revision History
PUTE SVDRP command (thanks to Olaf Titz for reporting this one). PUTE SVDRP command (thanks to Olaf Titz for reporting this one).
- Added the command line options '--lirc', '--rcu' and '--no-kbd' to allow setting - Added the command line options '--lirc', '--rcu' and '--no-kbd' to allow setting
the remote control at runtime (based on a patch by Darren Salt). the remote control at runtime (based on a patch by Darren Salt).
- Now checking whether timers or channels are currently being edited via the menu
before making changes through SVDRP (thanks to Andreas Brugger for reporting a
problem with this).

148
svdrp.c
View File

@ -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.72 2005/05/26 09:59:09 kls Exp $ * $Id: svdrp.c 1.73 2005/07/31 14:31:45 kls Exp $
*/ */
#include "svdrp.h" #include "svdrp.h"
@ -476,22 +476,26 @@ void cSVDRP::CmdDELC(const char *Option)
{ {
if (*Option) { if (*Option) {
if (isnumber(Option)) { if (isnumber(Option)) {
cChannel *channel = Channels.GetByNumber(strtol(Option, NULL, 10)); if (!Channels.BeingEdited()) {
if (channel) { cChannel *channel = Channels.GetByNumber(strtol(Option, NULL, 10));
for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) { if (channel) {
if (timer->Channel() == channel) { for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
Reply(550, "Channel \"%s\" is in use by timer %d", Option, timer->Index() + 1); if (timer->Channel() == channel) {
return; Reply(550, "Channel \"%s\" is in use by timer %d", Option, timer->Index() + 1);
return;
}
} }
} Channels.Del(channel);
Channels.Del(channel); Channels.ReNumber();
Channels.ReNumber(); Channels.SetModified(true);
Channels.SetModified(true); isyslog("channel %s deleted", Option);
isyslog("channel %s deleted", Option); Reply(250, "Channel \"%s\" deleted", Option);
Reply(250, "Channel \"%s\" deleted", Option); }
else
Reply(501, "Channel \"%s\" not defined", Option);
} }
else else
Reply(501, "Channel \"%s\" not defined", Option); Reply(550, "Channels are being edited - try again later");
} }
else else
Reply(501, "Error in channel number \"%s\"", Option); Reply(501, "Error in channel number \"%s\"", Option);
@ -532,19 +536,23 @@ void cSVDRP::CmdDELT(const char *Option)
{ {
if (*Option) { if (*Option) {
if (isnumber(Option)) { if (isnumber(Option)) {
cTimer *timer = Timers.Get(strtol(Option, NULL, 10) - 1); if (!Timers.BeingEdited()) {
if (timer) { cTimer *timer = Timers.Get(strtol(Option, NULL, 10) - 1);
if (!timer->Recording()) { if (timer) {
isyslog("deleting timer %s", *timer->ToDescr()); if (!timer->Recording()) {
Timers.Del(timer); isyslog("deleting timer %s", *timer->ToDescr());
Timers.SetModified(); Timers.Del(timer);
Reply(250, "Timer \"%s\" deleted", Option); Timers.SetModified();
Reply(250, "Timer \"%s\" deleted", Option);
}
else
Reply(550, "Timer \"%s\" is recording", Option);
} }
else else
Reply(550, "Timer \"%s\" is recording", Option); Reply(501, "Timer \"%s\" not defined", Option);
} }
else else
Reply(501, "Timer \"%s\" not defined", Option); Reply(550, "Timers are being edited - try again later");
} }
else else
Reply(501, "Error in timer number \"%s\"", Option); Reply(501, "Error in timer number \"%s\"", Option);
@ -880,25 +888,29 @@ void cSVDRP::CmdMODC(const char *Option)
int n = strtol(Option, &tail, 10); int n = strtol(Option, &tail, 10);
if (tail && tail != Option) { if (tail && tail != Option) {
tail = skipspace(tail); tail = skipspace(tail);
cChannel *channel = Channels.GetByNumber(n); if (!Channels.BeingEdited()) {
if (channel) { cChannel *channel = Channels.GetByNumber(n);
cChannel ch; if (channel) {
if (ch.Parse(tail)) { cChannel ch;
if (Channels.HasUniqueChannelID(&ch, channel)) { if (ch.Parse(tail)) {
*channel = ch; if (Channels.HasUniqueChannelID(&ch, channel)) {
Channels.ReNumber(); *channel = ch;
Channels.SetModified(true); Channels.ReNumber();
isyslog("modifed channel %d %s", channel->Number(), *channel->ToText()); Channels.SetModified(true);
Reply(250, "%d %s", channel->Number(), *channel->ToText()); isyslog("modifed channel %d %s", channel->Number(), *channel->ToText());
Reply(250, "%d %s", channel->Number(), *channel->ToText());
}
else
Reply(501, "Channel settings are not unique");
} }
else else
Reply(501, "Channel settings are not unique"); Reply(501, "Error in channel settings");
} }
else else
Reply(501, "Error in channel settings"); Reply(501, "Channel \"%d\" not defined", n);
} }
else else
Reply(501, "Channel \"%d\" not defined", n); Reply(550, "Channels are being edited - try again later");
} }
else else
Reply(501, "Error in channel number"); Reply(501, "Error in channel number");
@ -914,24 +926,28 @@ void cSVDRP::CmdMODT(const char *Option)
int n = strtol(Option, &tail, 10); int n = strtol(Option, &tail, 10);
if (tail && tail != Option) { if (tail && tail != Option) {
tail = skipspace(tail); tail = skipspace(tail);
cTimer *timer = Timers.Get(n - 1); if (!Timers.BeingEdited()) {
if (timer) { cTimer *timer = Timers.Get(n - 1);
cTimer t = *timer; if (timer) {
if (strcasecmp(tail, "ON") == 0) cTimer t = *timer;
t.SetFlags(tfActive); if (strcasecmp(tail, "ON") == 0)
else if (strcasecmp(tail, "OFF") == 0) t.SetFlags(tfActive);
t.ClrFlags(tfActive); else if (strcasecmp(tail, "OFF") == 0)
else if (!t.Parse(tail)) { t.ClrFlags(tfActive);
Reply(501, "Error in timer settings"); else if (!t.Parse(tail)) {
return; Reply(501, "Error in timer settings");
return;
}
*timer = t;
Timers.SetModified();
isyslog("timer %s modified (%s)", *timer->ToDescr(), timer->HasFlags(tfActive) ? "active" : "inactive");
Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
} }
*timer = t; else
Timers.SetModified(); Reply(501, "Timer \"%d\" not defined", n);
isyslog("timer %s modified (%s)", *timer->ToDescr(), timer->HasFlags(tfActive) ? "active" : "inactive");
Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
} }
else else
Reply(501, "Timer \"%d\" not defined", n); Reply(550, "Timers are being edited - try again later");
} }
else else
Reply(501, "Error in timer number"); Reply(501, "Error in timer number");
@ -1054,20 +1070,24 @@ void cSVDRP::CmdUPDT(const char *Option)
if (*Option) { if (*Option) {
cTimer *timer = new cTimer; cTimer *timer = new cTimer;
if (timer->Parse(Option)) { if (timer->Parse(Option)) {
cTimer *t = Timers.GetTimer(timer); if (!Timers.BeingEdited()) {
if (t) { cTimer *t = Timers.GetTimer(timer);
t->Parse(Option); if (t) {
delete timer; t->Parse(Option);
timer = t; delete timer;
isyslog("timer %s updated", *timer->ToDescr()); timer = t;
isyslog("timer %s updated", *timer->ToDescr());
}
else {
Timers.Add(timer);
isyslog("timer %s added", *timer->ToDescr());
}
Timers.SetModified();
Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
return;
} }
else { else
Timers.Add(timer); Reply(550, "Timers are being edited - try again later");
isyslog("timer %s added", *timer->ToDescr());
}
Timers.SetModified();
Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
return;
} }
else else
Reply(501, "Error in timer settings"); Reply(501, "Error in timer settings");