New SVDRP command STAT

This commit is contained in:
Klaus Schmidinger 2003-04-27 14:23:30 +02:00
parent 007c4a5a01
commit 3874eab49b
4 changed files with 26 additions and 2 deletions

View File

@ -592,6 +592,7 @@ Ludwig Nussel <ludwig.nussel@web.de>
Thomas Koch <tom@harhar.net> Thomas Koch <tom@harhar.net>
for his support in keeping the Premiere World channels up to date in 'channels.conf' 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> Stefan Hußfeldt <vdr@marvin.on-luebeck.de>
for his help in keeping 'channels.conf.cable' up to date for his help in keeping 'channels.conf.cable' up to date

View File

@ -2081,3 +2081,5 @@ Video Disk Recorder Revision History
is started through a user defined key macro (thanks to Andreas Mair for reporting is started through a user defined key macro (thanks to Andreas Mair for reporting
this one). this one).
- Reduced the time to wait for EPG data when starting a recording to 3 seconds. - 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).

22
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.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" #include "svdrp.h"
@ -33,6 +33,7 @@
#include "remote.h" #include "remote.h"
#include "timers.h" #include "timers.h"
#include "tools.h" #include "tools.h"
#include "videodir.h"
// --- cSocket --------------------------------------------------------------- // --- cSocket ---------------------------------------------------------------
@ -250,6 +251,8 @@ const char *HelpPages[] = {
" format defined in vdr(5) for the 'epg.data' file. A '.' on a line\n" " 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" " by itself terminates the input and starts processing of the data (all\n"
" entered data is buffered until the terminating '.' is seen).", " entered data is buffered until the terminating '.' is seen).",
"STAT disk\n"
" Return information about disk usage (total, free, percent).",
"UPDT <settings>\n" "UPDT <settings>\n"
" Updates a timer. Settings must be in the same format as returned\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" " 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); 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) void cSVDRP::CmdUPDT(const char *Option)
{ {
if (*Option) { if (*Option) {
@ -1021,6 +1040,7 @@ void cSVDRP::Execute(char *Cmd)
else if (CMD("NEWT")) CmdNEWT(s); else if (CMD("NEWT")) CmdNEWT(s);
else if (CMD("NEXT")) CmdNEXT(s); else if (CMD("NEXT")) CmdNEXT(s);
else if (CMD("PUTE")) CmdPUTE(s); else if (CMD("PUTE")) CmdPUTE(s);
else if (CMD("STAT")) CmdSTAT(s);
else if (CMD("UPDT")) CmdUPDT(s); else if (CMD("UPDT")) CmdUPDT(s);
else if (CMD("VOLU")) CmdVOLU(s); else if (CMD("VOLU")) CmdVOLU(s);
else if (CMD("QUIT")) Close(); else if (CMD("QUIT")) Close();

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __SVDRP_H
@ -73,6 +73,7 @@ private:
void CmdNEWT(const char *Option); void CmdNEWT(const char *Option);
void CmdNEXT(const char *Option); void CmdNEXT(const char *Option);
void CmdPUTE(const char *Option); void CmdPUTE(const char *Option);
void CmdSTAT(const char *Option);
void CmdUPDT(const char *Option); void CmdUPDT(const char *Option);
void CmdVOLU(const char *Option); void CmdVOLU(const char *Option);
void Execute(char *Cmd); void Execute(char *Cmd);