1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added AssertFreeDiskSpace() before starting a timer recording

This commit is contained in:
Klaus Schmidinger 2006-01-20 17:19:46 +01:00
parent 9038f45a0d
commit 611656bf46
3 changed files with 10 additions and 6 deletions

4
menu.c
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: menu.c 1.397 2006/01/20 16:28:18 kls Exp $ * $Id: menu.c 1.398 2006/01/20 17:19:46 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -3524,6 +3524,8 @@ bool cRecordControls::Start(cTimer *Timer, bool Pause)
{ {
static time_t LastNoDiskSpaceMessage = 0; static time_t LastNoDiskSpaceMessage = 0;
int FreeMB = 0; int FreeMB = 0;
if (Timer)
AssertFreeDiskSpace(Timer->Priority(), true);
VideoDiskSpace(&FreeMB); VideoDiskSpace(&FreeMB);
if (FreeMB < MINFREEDISK) { if (FreeMB < MINFREEDISK) {
if (!Timer || time(NULL) - LastNoDiskSpaceMessage > NODISKSPACEDELTA) { if (!Timer || time(NULL) - LastNoDiskSpaceMessage > NODISKSPACEDELTA) {

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: recording.c 1.132 2006/01/08 11:40:13 kls Exp $ * $Id: recording.c 1.133 2006/01/20 17:18:59 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -117,7 +117,7 @@ void RemoveDeletedRecordings(void)
} }
} }
void AssertFreeDiskSpace(int Priority) void AssertFreeDiskSpace(int Priority, bool Force)
{ {
static cMutex Mutex; static cMutex Mutex;
cMutexLock MutexLock(&Mutex); cMutexLock MutexLock(&Mutex);
@ -126,7 +126,7 @@ void AssertFreeDiskSpace(int Priority)
// it will get removed during the next call. // it will get removed during the next call.
static time_t LastFreeDiskCheck = 0; static time_t LastFreeDiskCheck = 0;
int Factor = (Priority == -1) ? 10 : 1; int Factor = (Priority == -1) ? 10 : 1;
if (time(NULL) - LastFreeDiskCheck > DISKCHECKDELTA / Factor) { if (Force || time(NULL) - LastFreeDiskCheck > DISKCHECKDELTA / Factor) {
if (!VideoFileSpaceAvailable(MINDISKSPACE)) { if (!VideoFileSpaceAvailable(MINDISKSPACE)) {
// Make sure only one instance of VDR does this: // Make sure only one instance of VDR does this:
cLockFile LockFile(VideoDirectory); cLockFile LockFile(VideoDirectory);

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: recording.h 1.48 2005/12/18 11:26:51 kls Exp $ * $Id: recording.h 1.49 2006/01/20 17:18:28 kls Exp $
*/ */
#ifndef __RECORDING_H #ifndef __RECORDING_H
@ -21,9 +21,11 @@
extern bool VfatFileSystem; extern bool VfatFileSystem;
void RemoveDeletedRecordings(void); void RemoveDeletedRecordings(void);
void AssertFreeDiskSpace(int Priority = 0); void AssertFreeDiskSpace(int Priority = 0, bool Force = false);
///< The special Priority value -1 means that we shall get rid of any ///< The special Priority value -1 means that we shall get rid of any
///< deleted recordings faster than normal (because we're cutting). ///< deleted recordings faster than normal (because we're cutting).
///< If Force is true, the check will be done even if the timeout
///< hasn't expired yet.
class cResumeFile { class cResumeFile {
private: private: