From c1ddb5240529ea8b3388808bce682248a07a2dd5 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 29 Jan 2014 10:51:18 +0100 Subject: Fixed sorting recordings by time in the Recordings menu if "Setup/OSD/Recording directories" is set to "no" --- recording.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'recording.c') diff --git a/recording.c b/recording.c index c1a00cf9..ef3144e2 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.91.1.3 2013/12/25 10:55:32 kls Exp $ + * $Id: recording.c 2.91.1.4 2014/01/29 10:50:28 kls Exp $ */ #include "recording.h" @@ -958,14 +958,22 @@ char *cRecording::SortName(void) const { char **sb = (RecordingsSortMode == rsmName) ? &sortBufferName : &sortBufferTime; if (!*sb) { - char *s = strdup(FileName() + strlen(VideoDirectory)); - if (RecordingsSortMode != rsmName || Setup.AlwaysSortFoldersFirst) - s = StripEpisodeName(s, RecordingsSortMode != rsmName); - strreplace(s, '/', '0'); // some locales ignore '/' when sorting - int l = strxfrm(NULL, s, 0) + 1; - *sb = MALLOC(char, l); - strxfrm(*sb, s, l); - free(s); + if (RecordingsSortMode == rsmTime && !Setup.RecordingDirs) { + char buf[32]; + struct tm tm_r; + strftime(buf, sizeof(buf), "%Y%m%d%H%I", localtime_r(&start, &tm_r)); + *sb = strdup(buf); + } + else { + char *s = strdup(FileName() + strlen(VideoDirectory)); + if (RecordingsSortMode != rsmName || Setup.AlwaysSortFoldersFirst) + s = StripEpisodeName(s, RecordingsSortMode != rsmName); + strreplace(s, '/', '0'); // some locales ignore '/' when sorting + int l = strxfrm(NULL, s, 0) + 1; + *sb = MALLOC(char, l); + strxfrm(*sb, s, l); + free(s); + } } return *sb; } -- cgit v1.2.3