summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2003-04-27 14:23:30 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2003-04-27 14:23:30 +0200
commit3874eab49bfc8b73ebdf02ca702ee8bf0983adff (patch)
tree7690cf5bd08937693f102f7c97294f0fc2764a79
parent007c4a5a012b5e2e5ab28175ca6376eb763dd494 (diff)
downloadvdr-3874eab49bfc8b73ebdf02ca702ee8bf0983adff.tar.gz
vdr-3874eab49bfc8b73ebdf02ca702ee8bf0983adff.tar.bz2
New SVDRP command STAT
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--svdrp.c22
-rw-r--r--svdrp.h3
4 files changed, 26 insertions, 2 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index d689e82d..ec9af62c 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -592,6 +592,7 @@ Ludwig Nussel <ludwig.nussel@web.de>
Thomas Koch <tom@harhar.net>
for his support in keeping the Premiere World channels up to date in 'channels.conf'
+ for implementing the SVDRP command STAT
Stefan Hußfeldt <vdr@marvin.on-luebeck.de>
for his help in keeping 'channels.conf.cable' up to date
diff --git a/HISTORY b/HISTORY
index e07d5a08..f7a38b73 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2081,3 +2081,5 @@ Video Disk Recorder Revision History
is started through a user defined key macro (thanks to Andreas Mair for reporting
this one).
- Reduced the time to wait for EPG data when starting a recording to 3 seconds.
+- The new SVDRP command STAT can be used to request information about the disk
+ usage (thanks to Thomas Koch).
diff --git a/svdrp.c b/svdrp.c
index 102abe0d..6dafddd1 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.50 2002/12/22 14:04:08 kls Exp $
+ * $Id: svdrp.c 1.51 2003/04/27 14:21:07 kls Exp $
*/
#include "svdrp.h"
@@ -33,6 +33,7 @@
#include "remote.h"
#include "timers.h"
#include "tools.h"
+#include "videodir.h"
// --- cSocket ---------------------------------------------------------------
@@ -250,6 +251,8 @@ const char *HelpPages[] = {
" format defined in vdr(5) for the 'epg.data' file. A '.' on a line\n"
" by itself terminates the input and starts processing of the data (all\n"
" entered data is buffered until the terminating '.' is seen).",
+ "STAT disk\n"
+ " Return information about disk usage (total, free, percent).",
"UPDT <settings>\n"
" Updates a timer. Settings must be in the same format as returned\n"
" by the LSTT command. If a timer with the same channel, day, start\n"
@@ -929,6 +932,22 @@ void cSVDRP::CmdPUTE(const char *Option)
DELETENULL(PUTEhandler);
}
+void cSVDRP::CmdSTAT(const char *Option)
+{
+ if (*Option) {
+ if (strcasecmp(Option, "DISK") == 0) {
+ int FreeMB;
+ int Percent = VideoDiskSpace(&FreeMB);
+ int Total = (FreeMB / (100 - Percent)) * 100;
+ Reply(250, "%dMB %dMB %d%%", Total, FreeMB, Percent);
+ }
+ else
+ Reply(501, "Invalid Option \"%s\"", Option);
+ }
+ else
+ Reply(501, "No option given");
+}
+
void cSVDRP::CmdUPDT(const char *Option)
{
if (*Option) {
@@ -1021,6 +1040,7 @@ void cSVDRP::Execute(char *Cmd)
else if (CMD("NEWT")) CmdNEWT(s);
else if (CMD("NEXT")) CmdNEXT(s);
else if (CMD("PUTE")) CmdPUTE(s);
+ else if (CMD("STAT")) CmdSTAT(s);
else if (CMD("UPDT")) CmdUPDT(s);
else if (CMD("VOLU")) CmdVOLU(s);
else if (CMD("QUIT")) Close();
diff --git a/svdrp.h b/svdrp.h
index 1052d633..67918ed5 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.18 2002/11/30 14:36:04 kls Exp $
+ * $Id: svdrp.h 1.19 2003/04/27 14:09:59 kls Exp $
*/
#ifndef __SVDRP_H
@@ -73,6 +73,7 @@ private:
void CmdNEWT(const char *Option);
void CmdNEXT(const char *Option);
void CmdPUTE(const char *Option);
+ void CmdSTAT(const char *Option);
void CmdUPDT(const char *Option);
void CmdVOLU(const char *Option);
void Execute(char *Cmd);