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

Fixed multiple occurrences of the same directory in the recordings list in case there are directories that only differ in non-alphanumeric characters

This commit is contained in:
Klaus Schmidinger 2013-01-16 16:08:20 +01:00
parent a9099cb4d3
commit 7a3f809f5c
3 changed files with 22 additions and 9 deletions

View File

@ -1006,6 +1006,8 @@ Andreas Mair <amair.sob@googlemail.com>
for fixing the type of MBperMinute in cVideoDiskUsage::HasChanged() for fixing the type of MBperMinute in cVideoDiskUsage::HasChanged()
for reporting a bug in sorting recordings in case two folders have the same name, for reporting a bug in sorting recordings in case two folders have the same name,
but one of them ends in an additional digit, as in "abc" and "abc2" but one of them ends in an additional digit, as in "abc" and "abc2"
for reporting multiple occurrences of the same directory in the recordings list ini
case there are directories that only differ in non-alphanumeric characters
Olivier Jacques <jacquesolivier@hotmail.com>) Olivier Jacques <jacquesolivier@hotmail.com>)
for translating OSD texts to the French language for translating OSD texts to the French language

View File

@ -7494,7 +7494,7 @@ Video Disk Recorder Revision History
use it. use it.
- Added maximum SNR value for PCTV Systems PCTV 73ESE (thanks to Cedric Dewijs). - Added maximum SNR value for PCTV Systems PCTV 73ESE (thanks to Cedric Dewijs).
2013-01-15: Version 1.7.36 2013-01-16: Version 1.7.36
- Added maximum SNR value for PCTV Systems nanoStick T2 290e (thanks to Antti - Added maximum SNR value for PCTV Systems nanoStick T2 290e (thanks to Antti
Hartikainen). Hartikainen).
@ -7520,3 +7520,6 @@ Video Disk Recorder Revision History
- The SVDRP command LSTR now knows the additional parameter "path", which can be - The SVDRP command LSTR now knows the additional parameter "path", which can be
given to get the actual file name of a recording's directory (suggested by given to get the actual file name of a recording's directory (suggested by
Stefan Stolz). Stefan Stolz).
- Fixed multiple occurrences of the same directory in the recordings list in case there
are directories that only differ in non-alphanumeric characters (reported by Andreas
Mair).

24
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 2.72 2012/12/21 11:11:14 kls Exp $ * $Id: menu.c 2.73 2013/01/16 15:58:58 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -2273,7 +2273,6 @@ void cMenuRecordings::Set(bool Refresh)
{ {
const char *CurrentRecording = cReplayControl::LastReplayed(); const char *CurrentRecording = cReplayControl::LastReplayed();
cMenuRecordingItem *LastItem = NULL; cMenuRecordingItem *LastItem = NULL;
char *LastItemText = NULL;
cThreadLock RecordingsLock(&Recordings); cThreadLock RecordingsLock(&Recordings);
if (Refresh) { if (Refresh) {
if (cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current())) if (cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()))
@ -2285,23 +2284,32 @@ void cMenuRecordings::Set(bool Refresh)
for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) { for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) {
if (!base || (strstr(recording->Name(), base) == recording->Name() && recording->Name()[strlen(base)] == FOLDERDELIMCHAR)) { if (!base || (strstr(recording->Name(), base) == recording->Name() && recording->Name()[strlen(base)] == FOLDERDELIMCHAR)) {
cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level); cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level);
if (*Item->Text() && (!Item->IsDirectory() || (!LastItem || !LastItem->IsDirectory() || strcmp(Item->Text(), LastItemText) != 0))) { cMenuRecordingItem *LastDir = NULL;
if (Item->IsDirectory()) {
// Sorting may ignore non-alphanumeric characters, so we need to explicitly handle directories in case they only differ in such characters:
for (cMenuRecordingItem *p = LastItem; p; p = dynamic_cast<cMenuRecordingItem *>(p->Prev())) {
if (p->Name() && strcmp(p->Name(), Item->Name()) == 0) {
LastDir = p;
break;
}
}
}
if (*Item->Text() && !LastDir) {
Add(Item); Add(Item);
LastItem = Item; LastItem = Item;
free(LastItemText); if (Item->IsDirectory())
LastItemText = strdup(LastItem->Text()); // must use a copy because of the counters! LastDir = Item;
} }
else else
delete Item; delete Item;
if (LastItem) { if (LastItem) {
if (CurrentRecording && strcmp(CurrentRecording, recording->FileName()) == 0) if (CurrentRecording && strcmp(CurrentRecording, recording->FileName()) == 0)
SetCurrent(LastItem); SetCurrent(LastItem);
if (LastItem->IsDirectory())
LastItem->IncrementCounter(recording->IsNew());
} }
if (LastDir)
LastDir->IncrementCounter(recording->IsNew());
} }
} }
free(LastItemText);
if (Refresh) if (Refresh)
Display(); Display();
} }