diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2020-11-01 10:29:07 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2020-11-01 10:29:07 +0100 |
commit | ebbc562aabf6f41a9314473ea6351b8fd6499c6e (patch) | |
tree | 168181af4900ace0790d89dca06d8a0daf86d771 /recording.c | |
parent | f387bb5e777607389d153e209ab7e3bcdbe5a0e8 (diff) | |
download | vdr-ebbc562aabf6f41a9314473ea6351b8fd6499c6e.tar.gz vdr-ebbc562aabf6f41a9314473ea6351b8fd6499c6e.tar.bz2 |
Fixed multiple recording entries in case a recording is started during the initial reading of the video directory
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/recording.c b/recording.c index 1fc34cdd..6bfbcff1 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 4.28 2020/09/16 13:30:59 kls Exp $ + * $Id: recording.c 4.29 2020/10/30 16:08:29 kls Exp $ */ #include "recording.h" @@ -1375,6 +1375,7 @@ class cVideoDirectoryScannerThread : public cThread { private: cRecordings *recordings; cRecordings *deletedRecordings; + int count; bool initial; void ScanVideoDir(const char *DirName, int LinkLevel = 0, int DirLevel = 0); protected: @@ -1389,6 +1390,7 @@ cVideoDirectoryScannerThread::cVideoDirectoryScannerThread(cRecordings *Recordin { recordings = Recordings; deletedRecordings = DeletedRecordings; + count = 0; initial = true; } @@ -1401,7 +1403,8 @@ void cVideoDirectoryScannerThread::Action(void) { cStateKey StateKey; recordings->Lock(StateKey); - initial = recordings->Count() == 0; // no name checking if the list is initially empty + count = recordings->Count(); + initial = count == 0; // no name checking if the list is initially empty StateKey.Remove(); deletedRecordings->Lock(StateKey, true); deletedRecordings->Clear(); @@ -1439,6 +1442,10 @@ void cVideoDirectoryScannerThread::ScanVideoDir(const char *DirName, int LinkLev if (Recordings) { cStateKey StateKey; Recordings->Lock(StateKey, true); + if (initial && count != recordings->Count()) { + dsyslog("activated name checking for initial read of video directory"); + initial = false; + } if (Recordings == deletedRecordings || initial || !Recordings->GetByName(buffer)) { cRecording *r = new cRecording(buffer); if (r->Name()) { @@ -1448,6 +1455,7 @@ void cVideoDirectoryScannerThread::ScanVideoDir(const char *DirName, int LinkLev if (Recordings == deletedRecordings) r->SetDeleted(); Recordings->Add(r); + count = recordings->Count(); } else delete r; |