summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-09-01 09:53:01 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-09-01 09:53:01 +0200
commit63105a78429114106d1063266e9e774467ad7fac (patch)
treee2dc1b1ba184ecbe7067377fa6c9b27c478aa3f4
parenta8f8de9dc9fda5fc94e5bc3d98dac5785e72d7da (diff)
downloadvdr-63105a78429114106d1063266e9e774467ad7fac.tar.gz
vdr-63105a78429114106d1063266e9e774467ad7fac.tar.bz2
New SVDRP command NEXT to show the next timer event
-rw-r--r--HISTORY1
-rw-r--r--svdrp.c35
-rw-r--r--svdrp.h3
3 files changed, 37 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 1de01112..b63ad74b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -681,4 +681,5 @@ Video Disk Recorder Revision History
- Changed version number notation.
- Implemented automatic shutdown (see INSTALL and MANUAL for details).
+- New SVDRP command NEXT to show the next timer event.
diff --git a/svdrp.c b/svdrp.c
index d3bceec1..5f8aad40 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.21 2001/08/12 15:10:16 kls Exp $
+ * $Id: svdrp.c 1.22 2001/09/01 09:50:03 kls Exp $
*/
#define _GNU_SOURCE
@@ -166,6 +166,16 @@ const char *HelpPages[] = {
" Create a new timer. Settings must be in the same format as returned\n"
" by the LSTT command. It is an error if a timer with the same channel,\n"
" day, start and stop time already exists.",
+ "NEXT [ abs | rel ]\n"
+ " Show the next timer event. If no option is given, the output will be\n"
+ " in human readable form. With option 'abs' the absolute time of the next\n"
+ " event will be given as the number of seconds since the epoch (time_t\n"
+ " format), while with option 'rel' the relative time will be given as the\n"
+ " number of seconds from now until the event. If the absolute time given\n"
+ " is smaller than the current time, or if the relative time is less than\n"
+ " zero, this means that the timer is currently recording and has started\n"
+ " at the given time. The first value in the resulting line is the number\n"
+ " of the timer.",
"OVLF <sizex> <sizey> <fbaddr> <bpp> <palette>\n"
" Set the size, address depth and palette of the overlay.",
"OVLG <sizex> <sizey> <posx> <posy>\n"
@@ -737,6 +747,28 @@ void cSVDRP::CmdNEWT(const char *Option)
Reply(501, "Missing timer settings");
}
+void cSVDRP::CmdNEXT(const char *Option)
+{
+ cTimer *t = Timers.GetNextActiveTimer();
+ if (t) {
+ time_t Start = t->StartTime();
+ int Number = t->Index() + 1;
+ if (!*Option) {
+ char *s = ctime(&Start);
+ s[strlen(s) - 1] = 0; // strip trailing newline
+ Reply(250, "%d %s", Number, s);
+ }
+ else if (strcasecmp(Option, "ABS") == 0)
+ Reply(250, "%d %ld", Number, Start);
+ else if (strcasecmp(Option, "REL") == 0)
+ Reply(250, "%d %ld", Number, Start - time(NULL));
+ else
+ Reply(501, "Unknown option: \"%s\"", Option);
+ }
+ else
+ Reply(550, "No active timers");
+}
+
void cSVDRP::CmdOVLF(const char *Option)
{
if (*Option) {
@@ -893,6 +925,7 @@ void cSVDRP::Execute(char *Cmd)
else if (CMD("MOVT")) CmdMOVT(s);
else if (CMD("NEWC")) CmdNEWC(s);
else if (CMD("NEWT")) CmdNEWT(s);
+ else if (CMD("NEXT")) CmdNEXT(s);
else if (CMD("OVLF")) CmdOVLF(s);
else if (CMD("OVLG")) CmdOVLG(s);
else if (CMD("OVLC")) CmdOVLC(s);
diff --git a/svdrp.h b/svdrp.h
index 83827082..503439a4 100644
--- a/svdrp.h
+++ b/svdrp.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: svdrp.h 1.9 2001/04/01 15:05:38 kls Exp $
+ * $Id: svdrp.h 1.10 2001/09/01 09:24:50 kls Exp $
*/
#ifndef __SVDRP_H
@@ -56,6 +56,7 @@ private:
void CmdMOVT(const char *Option);
void CmdNEWC(const char *Option);
void CmdNEWT(const char *Option);
+ void CmdNEXT(const char *Option);
void CmdOVLF(const char *Option);
void CmdOVLG(const char *Option);
void CmdOVLC(const char *Option);