Fixed multiple recording entries in case a recording is started during the initial reading of the video directory

This commit is contained in:
Klaus Schmidinger 2020-11-01 10:29:07 +01:00
parent f387bb5e77
commit ebbc562aab
3 changed files with 17 additions and 2 deletions

View File

@ -3484,6 +3484,8 @@ Stefan Schallenberg <infos@nafets.de>
Claus Muus <email@clausmuus.de> Claus Muus <email@clausmuus.de>
for adding the new parameters "Setup/Miscellaneous/Volume steps" and for adding the new parameters "Setup/Miscellaneous/Volume steps" and
".../Volume linearize" ".../Volume linearize"
for reporting multiple recording entries in case a recording is started during the
initial reading of the video directory
Dieter Ferdinand <dieter.ferdinand@gmx.de> Dieter Ferdinand <dieter.ferdinand@gmx.de>
for reporting a problem with jumping to an absolute position via the Red key in for reporting a problem with jumping to an absolute position via the Red key in

View File

@ -9535,3 +9535,8 @@ Video Disk Recorder Revision History
- Now initializing the status variable in cDvbTuner::GetFrontendStatus() and - Now initializing the status variable in cDvbTuner::GetFrontendStatus() and
cDvbTuner::GetSignalStats() to avoid problems with drivers that don't do this cDvbTuner::GetSignalStats() to avoid problems with drivers that don't do this
(thanks to Helmut Binder). (thanks to Helmut Binder).
2020-10-30:
- Fixed multiple recording entries in case a recording is started during the initial
reading of the video directory (reported by Claus Muus).

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 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" #include "recording.h"
@ -1375,6 +1375,7 @@ class cVideoDirectoryScannerThread : public cThread {
private: private:
cRecordings *recordings; cRecordings *recordings;
cRecordings *deletedRecordings; cRecordings *deletedRecordings;
int count;
bool initial; bool initial;
void ScanVideoDir(const char *DirName, int LinkLevel = 0, int DirLevel = 0); void ScanVideoDir(const char *DirName, int LinkLevel = 0, int DirLevel = 0);
protected: protected:
@ -1389,6 +1390,7 @@ cVideoDirectoryScannerThread::cVideoDirectoryScannerThread(cRecordings *Recordin
{ {
recordings = Recordings; recordings = Recordings;
deletedRecordings = DeletedRecordings; deletedRecordings = DeletedRecordings;
count = 0;
initial = true; initial = true;
} }
@ -1401,7 +1403,8 @@ void cVideoDirectoryScannerThread::Action(void)
{ {
cStateKey StateKey; cStateKey StateKey;
recordings->Lock(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(); StateKey.Remove();
deletedRecordings->Lock(StateKey, true); deletedRecordings->Lock(StateKey, true);
deletedRecordings->Clear(); deletedRecordings->Clear();
@ -1439,6 +1442,10 @@ void cVideoDirectoryScannerThread::ScanVideoDir(const char *DirName, int LinkLev
if (Recordings) { if (Recordings) {
cStateKey StateKey; cStateKey StateKey;
Recordings->Lock(StateKey, true); 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)) { if (Recordings == deletedRecordings || initial || !Recordings->GetByName(buffer)) {
cRecording *r = new cRecording(buffer); cRecording *r = new cRecording(buffer);
if (r->Name()) { if (r->Name()) {
@ -1448,6 +1455,7 @@ void cVideoDirectoryScannerThread::ScanVideoDir(const char *DirName, int LinkLev
if (Recordings == deletedRecordings) if (Recordings == deletedRecordings)
r->SetDeleted(); r->SetDeleted();
Recordings->Add(r); Recordings->Add(r);
count = recordings->Count();
} }
else else
delete r; delete r;