added DELT FORCE option to delete running timers (#554)

This commit is contained in:
schmirl 2010-01-29 12:03:01 +00:00
parent c882a991cc
commit 93c9aa9af0
3 changed files with 43 additions and 11 deletions

View File

@ -126,6 +126,7 @@ Artem Makhutov
Alwin Esch Alwin Esch
for adding XBMC support by extending VTP capabilities for adding XBMC support by extending VTP capabilities
for adding VDR 1.7.11 parental rating support for VTP LSTE command for adding VDR 1.7.11 parental rating support for VTP LSTE command
for adding the DELT FORCE option to delete running timers
BBlack BBlack
for reporting that updating recordings list on CmdPLAY is a bad idea for reporting that updating recordings list on CmdPLAY is a bad idea

View File

@ -1,6 +1,7 @@
VDR Plugin 'streamdev' Revision History VDR Plugin 'streamdev' Revision History
--------------------------------------- ---------------------------------------
- added DELT FORCE option to delete running timers (thanks to Alwin Esch)
- added VDR 1.7.11 parental rating support for VTP LSTE command (thanks to - added VDR 1.7.11 parental rating support for VTP LSTE command (thanks to
Alwin Esch) Alwin Esch)
- added Lithuanian translation (thanks to Valdemaras Pipiras) - added Lithuanian translation (thanks to Valdemaras Pipiras)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: connectionVTP.c,v 1.26 2010/01/29 11:44:52 schmirl Exp $ * $Id: connectionVTP.c,v 1.27 2010/01/29 12:03:02 schmirl Exp $
*/ */
#include "server/connectionVTP.h" #include "server/connectionVTP.h"
@ -1406,22 +1406,52 @@ bool cConnectionVTP::CmdDELT(const char *Option)
{ {
INIT_WRAPPER(); INIT_WRAPPER();
if (*Option) { if (*Option) {
if (isnumber(Option)) { int number = 0;
cTimer *timer = Timers.Get(strtol(Option, NULL, 10) - 1); bool force = false;
char buf[strlen(Option) + 1];
strcpy(buf, Option);
const char *delim = " \t";
char *strtok_next;
char *p = strtok_r(buf, delim, &strtok_next);
if (isnumber(p)) {
number = strtol(p, NULL, 10) - 1;
}
else if (strcasecmp(p, "FORCE") == 0) {
force = true;
}
if ((p = strtok_r(NULL, delim, &strtok_next)) != NULL) {
if (isnumber(p)) {
number = strtol(p, NULL, 10) - 1;
}
else if (strcasecmp(p, "FORCE") == 0) {
force = true;
}
else {
Reply(501, "Timer not found or wrong syntax");
}
}
cTimer *timer = Timers.Get(number);
if (timer) { if (timer) {
if (!timer->Recording()) { if (timer->Recording()) {
if (force) {
timer->Skip();
cRecordControls::Process(time(NULL));
}
else {
Reply(550, "Timer \"%i\" is recording", number);
EXIT_WRAPPER();
}
}
isyslog("deleting timer %s", *timer->ToDescr()); isyslog("deleting timer %s", *timer->ToDescr());
Timers.Del(timer); Timers.Del(timer);
Timers.SetModified(); Timers.SetModified();
Reply(250, "Timer \"%s\" deleted", Option); Reply(250, "Timer \"%i\" deleted", number);
} else } else
Reply(550, "Timer \"%s\" is recording", Option); Reply(501, "Timer \"%i\" not defined", number);
} else } else
Reply(501, "Timer \"%s\" not defined", Option); Reply(501, "Missing timer option");
} else
Reply(501, "Error in timer number \"%s\"", Option);
} else
Reply(501, "Missing timer number");
EXIT_WRAPPER(); EXIT_WRAPPER();
} }