From 3874eab49bfc8b73ebdf02ca702ee8bf0983adff Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 27 Apr 2003 14:23:30 +0200 Subject: New SVDRP command STAT --- CONTRIBUTORS | 1 + HISTORY | 2 ++ svdrp.c | 22 +++++++++++++++++++++- svdrp.h | 3 ++- 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 Thomas Koch for his support in keeping the Premiere World channels up to date in 'channels.conf' + for implementing the SVDRP command STAT Stefan Hußfeldt 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 \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); -- cgit v1.2.3