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

No longer trying to delete old recordings in AssertFreeDiskSpace() if the given Priority is less than 1

This commit is contained in:
Klaus Schmidinger 2013-08-21 13:56:33 +02:00
parent 7a359a958e
commit a0a4421278
2 changed files with 28 additions and 22 deletions

View File

@ -7869,3 +7869,5 @@ Video Disk Recorder Revision History
position has been reached. position has been reached.
- The LCARS skin now shows the source value of the current channel in its channel display. - The LCARS skin now shows the source value of the current channel in its channel display.
- Fixed asserting free disk space in the cutter. - Fixed asserting free disk space in the cutter.
- No longer trying to delete old recordings in AssertFreeDiskSpace() if the given
Priority is less than 1.

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 3.1 2013/04/11 08:14:01 kls Exp $ * $Id: recording.c 3.2 2013/08/21 13:56:33 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -178,34 +178,38 @@ void AssertFreeDiskSpace(int Priority, bool Force)
return; // the next call will actually remove it return; // the next call will actually remove it
} }
// No "deleted" files to remove, so let's see if we can delete a recording: // No "deleted" files to remove, so let's see if we can delete a recording:
isyslog("...no deleted recording found, trying to delete an old recording..."); if (Priority > 0) {
cThreadLock RecordingsLock(&Recordings); isyslog("...no deleted recording found, trying to delete an old recording...");
if (Recordings.Count()) { cThreadLock RecordingsLock(&Recordings);
cRecording *r = Recordings.First(); if (Recordings.Count()) {
cRecording *r0 = NULL; cRecording *r = Recordings.First();
while (r) { cRecording *r0 = NULL;
if (r->IsOnVideoDirectoryFileSystem()) { // only delete recordings that will actually increase the free video disk space while (r) {
if (!r->IsEdited() && r->Lifetime() < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever if (r->IsOnVideoDirectoryFileSystem()) { // only delete recordings that will actually increase the free video disk space
if ((r->Lifetime() == 0 && Priority > r->Priority()) || // the recording has no guaranteed lifetime and the new recording has higher priority if (!r->IsEdited() && r->Lifetime() < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever
(r->Lifetime() > 0 && (time(NULL) - r->Start()) / SECSINDAY >= r->Lifetime())) { // the recording's guaranteed lifetime has expired if ((r->Lifetime() == 0 && Priority > r->Priority()) || // the recording has no guaranteed lifetime and the new recording has higher priority
if (r0) { (r->Lifetime() > 0 && (time(NULL) - r->Start()) / SECSINDAY >= r->Lifetime())) { // the recording's guaranteed lifetime has expired
if (r->Priority() < r0->Priority() || (r->Priority() == r0->Priority() && r->Start() < r0->Start())) if (r0) {
r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities) if (r->Priority() < r0->Priority() || (r->Priority() == r0->Priority() && r->Start() < r0->Start()))
r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities)
}
else
r0 = r;
} }
else
r0 = r;
} }
} }
r = Recordings.Next(r);
} }
r = Recordings.Next(r); if (r0 && r0->Delete()) {
Recordings.Del(r0);
return;
} }
if (r0 && r0->Delete()) {
Recordings.Del(r0);
return;
} }
// Unable to free disk space, but there's nothing we can do about that...
isyslog("...no old recording found, giving up");
} }
// Unable to free disk space, but there's nothing we can do about that... else
isyslog("...no old recording found, giving up"); isyslog("...no deleted recording found, priority %d too low to trigger deleting an old recording", Priority);
Skins.QueueMessage(mtWarning, tr("Low disk space!"), 5, -1); Skins.QueueMessage(mtWarning, tr("Low disk space!"), 5, -1);
} }
LastFreeDiskCheck = time(NULL); LastFreeDiskCheck = time(NULL);