diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-20 16:34:56 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-20 16:34:56 +0100 |
commit | 9038f45a0d0996043ba79cdd38c4f0c6153f64ba (patch) | |
tree | 2932b659156a3c4f26bd144599c3a531a37844d6 /menu.c | |
parent | 9e1b89ec5c4c8760014dc8e1109bb16a05b3ec4d (diff) | |
download | vdr-9038f45a0d0996043ba79cdd38c4f0c6153f64ba.tar.gz vdr-9038f45a0d0996043ba79cdd38c4f0c6153f64ba.tar.bz2 |
Recordings are now only started if there is at least 300MB free disk space
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.396 2006/01/15 15:02:36 kls Exp $ + * $Id: menu.c 1.397 2006/01/20 16:28:18 kls Exp $ */ #include "menu.h" @@ -36,6 +36,8 @@ #define MAXRECORDCONTROLS (MAXDEVICES * MAXRECEIVERS) #define MAXINSTANTRECTIME (24 * 60 - 1) // 23:59 hours #define MAXWAITFORCAMMENU 4 // seconds to wait for the CAM menu to open +#define MINFREEDISK 300 // minimum free disk space required to start recording +#define NODISKSPACEDELTA 300 // seconds between "Not enough disk space to start recording!" messages #define CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1) @@ -3520,6 +3522,19 @@ int cRecordControls::state = 0; bool cRecordControls::Start(cTimer *Timer, bool Pause) { + static time_t LastNoDiskSpaceMessage = 0; + int FreeMB = 0; + VideoDiskSpace(&FreeMB); + if (FreeMB < MINFREEDISK) { + if (!Timer || time(NULL) - LastNoDiskSpaceMessage > NODISKSPACEDELTA) { + isyslog("not enough disk space to start recording%s%s", Timer ? " timer " : "", Timer ? *Timer->ToDescr() : ""); + Skins.Message(mtWarning, tr("Not enough disk space to start recording!")); + LastNoDiskSpaceMessage = time(NULL); + } + return false; + } + LastNoDiskSpaceMessage = 0; + ChangeState(); int ch = Timer ? Timer->Channel()->Number() : cDevice::CurrentChannel(); cChannel *channel = Channels.GetByNumber(ch); @@ -3548,8 +3563,10 @@ bool cRecordControls::Start(cTimer *Timer, bool Pause) } } } - else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending())) + else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending())) { isyslog("no free DVB device to record channel %d!", ch); + Skins.Message(mtError, tr("No free DVB device to record!")); + } } else esyslog("ERROR: channel %d not defined!", ch); |