diff --git a/HISTORY b/HISTORY index ba6f73fb..10a268a5 100644 --- a/HISTORY +++ b/HISTORY @@ -787,7 +787,7 @@ Video Disk Recorder Revision History - Made the volume, mute and power keys work when a menu is active, too (thanks to Matthias Weingart). -2001-10-06: Version 0.97 +2001-10-07: Version 0.97 - Implemented a lock file to prevent more than one instance of VDR from removing files from the video directory at the same time. @@ -805,3 +805,8 @@ Video Disk Recorder Revision History - Fixed the "EPG bugfix" (sometimes had duplicate information in Subtitle and Extended Description). - Fixed checking for valid video device when setting the video mode. +- The external command 'sort' is no longer required. VDR now sorts the list of + recordings itself, making sure that recordings that stem from repeating timers + are sorted chronologically. Sorting is done according to the setting of the + current locale, so you may want to make sure LC_COLLATE is set to the desired + value (see INSTALL). diff --git a/INSTALL b/INSTALL index 7b3e070e..e7e67316 100644 --- a/INSTALL +++ b/INSTALL @@ -90,6 +90,24 @@ option to set the controlling terminal, as in vdr:123:respawn:/usr/local/bin/vdr --terminal=/dev/tty8 -w 60 +Locale +------ + +When presenting the list of recordings, VDR sorts the entries according to +the current "locale" settings. This makes sure that special characters (like +the German "umlauts") appear at the expected positions. In order to benefit +from this you may have to set the locale environment variable, for instance + + export LANG=de_DE + +for a German locale. If you don't want this to result in German error messages +in the log file, it is sufficient to just set + + export LC_COLLATE=de_DE + +which only influences the way strings are sorted and leaves error messages +in English. + Automatic restart in case of hangups: ------------------------------------- diff --git a/recording.c b/recording.c index 11fb851e..21dddf97 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 1.38 2001/09/30 10:29:11 kls Exp $ + * $Id: recording.c 1.39 2001/10/07 11:00:35 kls Exp $ */ #define _GNU_SOURCE @@ -32,7 +32,7 @@ #define SUMMARYFILESUFFIX "/summary.vdr" #define MARKSFILESUFFIX "/marks.vdr" -#define FINDCMD "find %s -follow -type d -name '%s' 2> /dev/null | sort -df" +#define FINDCMD "find %s -follow -type d -name '%s' 2> /dev/null" #define MINDISKSPACE 1024 // MB @@ -215,6 +215,7 @@ char *ExchangeChars(char *s, bool ToFileSystem) cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary) { titleBuffer = NULL; + sortBuffer = NULL; fileName = NULL; if (Timer->IsSingleEvent() || !Setup.UseSubtitle) name = strdup(Timer->file); @@ -243,6 +244,7 @@ cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary) cRecording::cRecording(const char *FileName) { titleBuffer = NULL; + sortBuffer = NULL; fileName = strdup(FileName); FileName += strlen(VideoDirectory) + 1; char *p = strrchr(FileName, '/'); @@ -302,11 +304,50 @@ cRecording::cRecording(const char *FileName) cRecording::~cRecording() { delete titleBuffer; + delete sortBuffer; delete fileName; delete name; delete summary; } +char *cRecording::StripEpisodeName(char *s) +{ + char *t = s, *s1 = NULL, *s2 = NULL; + while (*t) { + if (*t == '/') { + if (s1) { + if (s2) + s1 = s2; + s2 = t; + } + else + s1 = t; + } + t++; + } + if (s1 && s2) + memmove(s1 + 1, s2, t - s2 + 1); + return s; +} + +char *cRecording::SortName(void) +{ + if (!sortBuffer) { + char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory) + 1)); + int l = strxfrm(NULL, s, 0); + sortBuffer = new char[l]; + strxfrm(sortBuffer, s, l); + delete s; + } + return sortBuffer; +} + +bool cRecording::operator< (const cListObject &ListObject) +{ + cRecording *r = (cRecording *)&ListObject; + return strcasecmp(SortName(), r->SortName()) < 0; +} + const char *cRecording::FileName(void) { if (!fileName) { @@ -409,6 +450,7 @@ bool cRecordings::Load(bool Deleted) delete r; } pclose(p); + Sort(); result = Count() > 0; } else diff --git a/recording.h b/recording.h index d2391a90..aead97e3 100644 --- a/recording.h +++ b/recording.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.h 1.17 2001/09/23 13:43:58 kls Exp $ + * $Id: recording.h 1.18 2001/10/07 10:38:56 kls Exp $ */ #ifndef __RECORDING_H @@ -32,9 +32,12 @@ class cRecording : public cListObject { friend class cRecordings; private: char *titleBuffer; + char *sortBuffer; char *fileName; char *name; char *summary; + char *StripEpisodeName(char *s); + char *SortName(void); public: time_t start; int priority; @@ -42,6 +45,7 @@ public: cRecording(cTimer *Timer, const char *Subtitle, const char *Summary); cRecording(const char *FileName); ~cRecording(); + virtual bool operator< (const cListObject &ListObject); const char *FileName(void); const char *Title(char Delimiter = ' ', bool NewIndicator = false); const char *Summary(void) { return summary; } diff --git a/vdr.c b/vdr.c index 804d3637..3df728bd 100644 --- a/vdr.c +++ b/vdr.c @@ -22,11 +22,12 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: vdr.c 1.81 2001/09/30 12:13:38 kls Exp $ + * $Id: vdr.c 1.82 2001/10/07 10:28:32 kls Exp $ */ #define _GNU_SOURCE #include +#include #include #include #include @@ -75,6 +76,10 @@ static void Watchdog(int signum) int main(int argc, char *argv[]) { + // Initiate locale: + + setlocale(LC_ALL, ""); + // Command line options: #define DEFAULTSVDRPPORT 2001