Recordings are now only started if there is at least 300MB free disk space

This commit is contained in:
Klaus Schmidinger 2006-01-20 16:34:56 +01:00
parent 9e1b89ec5c
commit 9038f45a0d
5 changed files with 47 additions and 8 deletions

View File

@ -1671,3 +1671,6 @@ Franz Gangkofer <Franz.Gangkofer@cadsoft.de>
Malte Schröder <MalteSch@gmx.de>
for reporting a crash after executing the SVDRP command CLRE
Markus Hahn <mhahn@reel-multimedia.com>
for suggesting to only start recordings if there is at least 300MB free disk space

View File

@ -4206,3 +4206,5 @@ Video Disk Recorder Revision History
Rolf Ahrenberg). cEvent::FixEpgBugs() now assigns a "No title" string to events
that have no title.
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
- Recordings are now only started if there is at least 300MB free disk space
(suggested by Markus Hahn).

23
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.237 2006/01/20 14:33:39 kls Exp $
* $Id: i18n.c 1.238 2006/01/20 16:30:00 kls Exp $
*
* Translations provided by:
*
@ -2336,6 +2336,27 @@ const tI18nPhrase Phrases[] = {
"Väljalülitamine ebaõnnestus - '-s' parameeter puudub!",
"Kan ikke slukke - parameter '-s' ikke angivet!",
},
{ "Not enough disk space to start recording!",
"Nicht genügend Plattenplatz für Aufnahme!",
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
"",//TODO
},
{ "Low disk space!",
"Platte beinahe voll!",
"Premalo prostora na disku!",

21
menu.c
View File

@ -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);

6
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
* $Id: vdr.c 1.241 2006/01/16 17:05:49 kls Exp $
* $Id: vdr.c 1.242 2006/01/20 16:12:39 kls Exp $
*/
#include <getopt.h>
@ -902,8 +902,6 @@ int main(int argc, char *argv[])
if (!cControl::Control()) {
if (cRecordControls::Start())
Skins.Message(mtInfo, tr("Recording started"));
else
Skins.Message(mtError, tr("No free DVB device to record!"));
key = kNone; // nobody else needs to see this key
}
break;
@ -947,8 +945,6 @@ int main(int argc, char *argv[])
case osRecord: DELETE_MENU;
if (cRecordControls::Start())
Skins.Message(mtInfo, tr("Recording started"));
else
Skins.Message(mtError, tr("No free DVB device to record!"));
break;
case osRecordings:
DELETE_MENU;