From c1ddb5240529ea8b3388808bce682248a07a2dd5 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 29 Jan 2014 10:51:18 +0100 Subject: [PATCH] Fixed sorting recordings by time in the Recordings menu if "Setup/OSD/Recording directories" is set to "no" --- HISTORY | 4 +++- menu.c | 4 ++-- recording.c | 26 +++++++++++++++++--------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/HISTORY b/HISTORY index c69c35b8..78dd77c8 100644 --- a/HISTORY +++ b/HISTORY @@ -7870,7 +7870,7 @@ Video Disk Recorder Revision History and also to use the correct directory with --edit (the latter reported by Marko Mäkelä). -2014-01-28: Version 2.0.6 +2014-01-29: Version 2.0.6 - Updated 'sources.conf' (thanks to Antti Hartikainen). - cFont::CreateFont() now returns a dummy font in case there are no fonts installed. @@ -7885,3 +7885,5 @@ Video Disk Recorder Revision History of actual video TS packets in cTsPayload in order to be able to record channels that sometimes need even more than 10 TS packets for detecting frame borders (reported by Eike Sauer and Oliver Endriss). +- Fixed sorting recordings by time in the Recordings menu if "Setup/OSD/Recording + directories" is set to "no". diff --git a/menu.c b/menu.c index 44f00550..6935838e 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 2.82.1.5 2013/10/16 09:46:24 kls Exp $ + * $Id: menu.c 2.82.1.6 2014/01/29 10:48:02 kls Exp $ */ #include "menu.h" @@ -2648,7 +2648,7 @@ eOSState cMenuSetupOSD::ProcessKey(eKeys Key) ModifiedAppearance = true; if (strcmp(data.FontFix, Setup.FontFix) || !DoubleEqual(data.FontFixSizeP, Setup.FontFixSizeP)) ModifiedAppearance = true; - if (data.AlwaysSortFoldersFirst != Setup.AlwaysSortFoldersFirst) + if (data.AlwaysSortFoldersFirst != Setup.AlwaysSortFoldersFirst || data.RecordingDirs != Setup.RecordingDirs) Recordings.ClearSortNames(); } 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; }