mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed deleting the source recording after moving it to a different volume (cont'd)
This commit is contained in:
parent
2e41129c36
commit
35d4ceaf37
32
recording.c
32
recording.c
@ -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.12 2014/01/16 11:03:41 kls Exp $
|
* $Id: recording.c 3.13 2014/01/18 12:54:56 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
@ -1519,22 +1519,24 @@ void cRecordings::DelByName(const char *FileName)
|
|||||||
{
|
{
|
||||||
LOCK_THREAD;
|
LOCK_THREAD;
|
||||||
cRecording *recording = GetByName(FileName);
|
cRecording *recording = GetByName(FileName);
|
||||||
if (recording) {
|
cRecording *dummy = NULL;
|
||||||
cThreadLock DeletedRecordingsLock(&DeletedRecordings);
|
if (!recording)
|
||||||
|
recording = dummy = new cRecording(FileName); // allows us to use a FileName that is not in the Recordings list
|
||||||
|
cThreadLock DeletedRecordingsLock(&DeletedRecordings);
|
||||||
|
if (!dummy)
|
||||||
Del(recording, false);
|
Del(recording, false);
|
||||||
char *ext = strrchr(recording->fileName, '.');
|
char *ext = strrchr(recording->fileName, '.');
|
||||||
if (ext) {
|
if (ext) {
|
||||||
strncpy(ext, DELEXT, strlen(ext));
|
strncpy(ext, DELEXT, strlen(ext));
|
||||||
if (access(recording->FileName(), F_OK) == 0) {
|
if (access(recording->FileName(), F_OK) == 0) {
|
||||||
recording->deleted = time(NULL);
|
recording->deleted = time(NULL);
|
||||||
DeletedRecordings.Add(recording);
|
DeletedRecordings.Add(recording);
|
||||||
recording = NULL; // to prevent it from being deleted below
|
recording = NULL; // to prevent it from being deleted below
|
||||||
}
|
|
||||||
}
|
}
|
||||||
delete recording;
|
|
||||||
ChangeState();
|
|
||||||
TouchUpdate();
|
|
||||||
}
|
}
|
||||||
|
delete recording;
|
||||||
|
ChangeState();
|
||||||
|
TouchUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRecordings::UpdateByName(const char *FileName)
|
void cRecordings::UpdateByName(const char *FileName)
|
||||||
@ -1880,7 +1882,7 @@ bool cRecordingsHandlerEntry::Active(bool &Error)
|
|||||||
if (CopierFinishedOk && (Usage() & ruMove) != 0) {
|
if (CopierFinishedOk && (Usage() & ruMove) != 0) {
|
||||||
cRecording Recording(FileNameSrc());
|
cRecording Recording(FileNameSrc());
|
||||||
if (Recording.Delete())
|
if (Recording.Delete())
|
||||||
DeletedRecordings.AddByName(Recording.FileName());
|
Recordings.DelByName(Recording.FileName());
|
||||||
}
|
}
|
||||||
Recordings.ChangeState();
|
Recordings.ChangeState();
|
||||||
Recordings.TouchUpdate();
|
Recordings.TouchUpdate();
|
||||||
|
Loading…
Reference in New Issue
Block a user