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

Sorting recordings internally, with episodes sorted chronologically

This commit is contained in:
Klaus Schmidinger 2001-10-07 11:00:35 +02:00
parent df15ec5f91
commit b8471a3f11
5 changed files with 79 additions and 5 deletions

View File

@ -787,7 +787,7 @@ Video Disk Recorder Revision History
- Made the volume, mute and power keys work when a menu is active, too (thanks - Made the volume, mute and power keys work when a menu is active, too (thanks
to Matthias Weingart). 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 - Implemented a lock file to prevent more than one instance of VDR from removing
files from the video directory at the same time. 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 - Fixed the "EPG bugfix" (sometimes had duplicate information in Subtitle and
Extended Description). Extended Description).
- Fixed checking for valid video device when setting the video mode. - 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).

18
INSTALL
View File

@ -90,6 +90,24 @@ option to set the controlling terminal, as in
vdr:123:respawn:/usr/local/bin/vdr --terminal=/dev/tty8 -w 60 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: Automatic restart in case of hangups:
------------------------------------- -------------------------------------

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: 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 #define _GNU_SOURCE
@ -32,7 +32,7 @@
#define SUMMARYFILESUFFIX "/summary.vdr" #define SUMMARYFILESUFFIX "/summary.vdr"
#define MARKSFILESUFFIX "/marks.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 #define MINDISKSPACE 1024 // MB
@ -215,6 +215,7 @@ char *ExchangeChars(char *s, bool ToFileSystem)
cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary) cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary)
{ {
titleBuffer = NULL; titleBuffer = NULL;
sortBuffer = NULL;
fileName = NULL; fileName = NULL;
if (Timer->IsSingleEvent() || !Setup.UseSubtitle) if (Timer->IsSingleEvent() || !Setup.UseSubtitle)
name = strdup(Timer->file); name = strdup(Timer->file);
@ -243,6 +244,7 @@ cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary)
cRecording::cRecording(const char *FileName) cRecording::cRecording(const char *FileName)
{ {
titleBuffer = NULL; titleBuffer = NULL;
sortBuffer = NULL;
fileName = strdup(FileName); fileName = strdup(FileName);
FileName += strlen(VideoDirectory) + 1; FileName += strlen(VideoDirectory) + 1;
char *p = strrchr(FileName, '/'); char *p = strrchr(FileName, '/');
@ -302,11 +304,50 @@ cRecording::cRecording(const char *FileName)
cRecording::~cRecording() cRecording::~cRecording()
{ {
delete titleBuffer; delete titleBuffer;
delete sortBuffer;
delete fileName; delete fileName;
delete name; delete name;
delete summary; 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) const char *cRecording::FileName(void)
{ {
if (!fileName) { if (!fileName) {
@ -409,6 +450,7 @@ bool cRecordings::Load(bool Deleted)
delete r; delete r;
} }
pclose(p); pclose(p);
Sort();
result = Count() > 0; result = Count() > 0;
} }
else else

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: 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 #ifndef __RECORDING_H
@ -32,9 +32,12 @@ class cRecording : public cListObject {
friend class cRecordings; friend class cRecordings;
private: private:
char *titleBuffer; char *titleBuffer;
char *sortBuffer;
char *fileName; char *fileName;
char *name; char *name;
char *summary; char *summary;
char *StripEpisodeName(char *s);
char *SortName(void);
public: public:
time_t start; time_t start;
int priority; int priority;
@ -42,6 +45,7 @@ public:
cRecording(cTimer *Timer, const char *Subtitle, const char *Summary); cRecording(cTimer *Timer, const char *Subtitle, const char *Summary);
cRecording(const char *FileName); cRecording(const char *FileName);
~cRecording(); ~cRecording();
virtual bool operator< (const cListObject &ListObject);
const char *FileName(void); const char *FileName(void);
const char *Title(char Delimiter = ' ', bool NewIndicator = false); const char *Title(char Delimiter = ' ', bool NewIndicator = false);
const char *Summary(void) { return summary; } const char *Summary(void) { return summary; }

7
vdr.c
View File

@ -22,11 +22,12 @@
* *
* The project's page is at http://www.cadsoft.de/people/kls/vdr * 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 #define _GNU_SOURCE
#include <getopt.h> #include <getopt.h>
#include <locale.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -75,6 +76,10 @@ static void Watchdog(int signum)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// Initiate locale:
setlocale(LC_ALL, "");
// Command line options: // Command line options:
#define DEFAULTSVDRPPORT 2001 #define DEFAULTSVDRPPORT 2001