diff options
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/recording.c b/recording.c index ca50f433..09c238df 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 2.81 2012/12/23 15:11:28 kls Exp $ + * $Id: recording.c 2.82 2013/01/13 11:47:44 kls Exp $ */ #include "recording.h" @@ -824,10 +824,10 @@ char *cRecording::StripEpisodeName(char *s) } if (s1 && s2) { // To have folders sorted before plain recordings, the '/' s1 points to - // is replaced by the character 'b'. All other slashes will be replaced - // by 'a' in SortName() (see below), which will result in the desired + // is replaced by the character '1'. All other slashes will be replaced + // by '0' in SortName() (see below), which will result in the desired // sequence: - *s1 = 'b'; + *s1 = '1'; s1++; memmove(s1, s2, t - s2 + 1); } @@ -840,7 +840,13 @@ char *cRecording::SortName(void) const if (!*sb) { char *s = (RecordingsSortMode == rsmName) ? strdup(FileName() + strlen(VideoDirectory)) : StripEpisodeName(strdup(FileName() + strlen(VideoDirectory))); - strreplace(s, '/', 'a'); // some locales ignore '/' when sorting + strreplace(s, '/', '0'); // some locales ignore '/' when sorting + for (char *p = s; *p; p++) { + if (*p == '/') + *p = '0'; // some locales ignore '/' when sorting + else if (*p < '0') + *p = ' '; // avoids multiple occurences of the same folder in case the locale ignores non-alphanumeric characters when sorting + } int l = strxfrm(NULL, s, 0) + 1; *sb = MALLOC(char, l); strxfrm(*sb, s, l); |