diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2001-10-21 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2001-10-21 18:00:00 +0200 |
commit | 8465398c6d2a57bc30a07fb61353a7c8ba6db574 (patch) | |
tree | f2e14e51ab0a43ebd3c148376c5be73f4bd1434d /recording.c | |
parent | 66bab90b60048a46e401ea506d3aa65c43779700 (diff) | |
download | vdr-patch-lnbsharing-8465398c6d2a57bc30a07fb61353a7c8ba6db574.tar.gz vdr-patch-lnbsharing-8465398c6d2a57bc30a07fb61353a7c8ba6db574.tar.bz2 |
Version 0.97vdr-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.
- The new setup parameter SplitEditedFiles can be used to control whether or
not the result of an editing process shall be written into separate files.
- Fixed handling repeat function when using LIRC (thanks to Matthias Weingart).
- The shutdown program (defined with the '-s' option) now also gets the channel
number and recording title of the timer (see INSTALL).
- New channel data for 'Premiere One', 'Premiere X-Action', 'Fox Kids Türkce'
and 'N24' (thanks to Andreas Share, Ulrich Röder, Uwe Scheffler and Simon
Bauschulte). Note that if you are using the default 'channels.conf' or
'channels.conf.cable' files you may need to check any exiting timers to see
whether they still use the correct channel number.
- 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).
- Fixed handling 'newline' characters in EPG texts (thanks to Rolf Hakenes for
an improved version of his 'libdtv').
Newline characters are always mapped to a single "blank" in VDR, because they
would otherwise disturb the Title and Subtitle layout in the channel display
(where these are assumed to be single line texts) and would have to be
specially handled in the 'epg.data' file and the LSTE command in SVDRP.
- Mapping ` ("backtick") characters in EPG texts to ' (single quote).
- Fixed timers starting and ending at unexpected times. 'localtime()' was not
thread safe, now using localtime_r().
- Removed the "system time seen..." message.
- Fixed a bug in the replay mode display when pressing the Green or Yellow
button while in trick mode (thanks to Stefan Huelswitt)
- Closing all open file descriptors when calling external programs.
- The menu timeout now also works when pressing the "Back" button during replay
to enter the "Recordings" menu.
- Updated 'channels.conf' for the "Bundesliga" channels of Premiere World
(thanks to Helmut Schächner).
- Fixed reading timers.conf and channels.conf that contain blanks after numeric
values.
- Fixed handling trick modes near the beginning and end of a recording.
- Pressing the "Back" button while replaying a DVD now leads to the DVD menu.
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 66 |
1 files changed, 59 insertions, 7 deletions
diff --git a/recording.c b/recording.c index df50407..fe56a6e 100644 --- a/recording.c +++ b/recording.c @@ -4,10 +4,9 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.37 2001/09/23 13:43:29 kls Exp $ + * $Id: recording.c 1.42 2001/10/20 10:28:28 kls Exp $ */ -#define _GNU_SOURCE #include "recording.h" #include <errno.h> #include <fcntl.h> @@ -32,7 +31,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 @@ -45,6 +44,10 @@ void RemoveDeletedRecordings(void) { static time_t LastRemoveCheck = 0; if (time(NULL) - LastRemoveCheck > REMOVECHECKDELTA) { + // Make sure only one instance of VDR does this: + cLockFile LockFile(VideoDirectory); + if (!LockFile.Lock()) + return; // Remove the oldest file that has been "deleted": cRecordings Recordings; if (Recordings.Load(true)) { @@ -74,6 +77,10 @@ void AssertFreeDiskSpace(int Priority) static time_t LastFreeDiskCheck = 0; if (time(NULL) - LastFreeDiskCheck > DISKCHECKDELTA) { if (!VideoFileSpaceAvailable(MINDISKSPACE)) { + // Make sure only one instance of VDR does this: + cLockFile LockFile(VideoDirectory); + if (!LockFile.Lock()) + return; // Remove the oldest file that has been "deleted": cRecordings Recordings; if (Recordings.Load(true)) { @@ -207,6 +214,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); @@ -235,6 +243,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, '/'); @@ -243,7 +252,8 @@ cRecording::cRecording(const char *FileName) summary = NULL; if (p) { time_t now = time(NULL); - struct tm t = *localtime(&now); // this initializes the time zone in 't' + struct tm tm_r; + struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't' t.tm_isdst = -1; // makes sure mktime() will determine the correct dst setting if (7 == sscanf(p + 1, DATAFORMAT, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &priority, &lifetime)) { t.tm_year -= 1900; @@ -294,15 +304,55 @@ 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) { - struct tm *t = localtime(&start); + struct tm tm_r; + struct tm *t = localtime_r(&start, &tm_r); ExchangeChars(name, true); asprintf(&fileName, NAMEFORMAT, VideoDirectory, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, priority, lifetime); ExchangeChars(name, false); @@ -320,7 +370,8 @@ const char *cRecording::Title(char Delimiter, bool NewIndicator) } delete titleBuffer; titleBuffer = NULL; - struct tm *t = localtime(&start); + struct tm tm_r; + struct tm *t = localtime_r(&start, &tm_r); asprintf(&titleBuffer, "%02d.%02d%c%02d:%02d%c%c%s", t->tm_mday, t->tm_mon + 1, @@ -401,6 +452,7 @@ bool cRecordings::Load(bool Deleted) delete r; } pclose(p); + Sort(); result = Count() > 0; } else @@ -523,7 +575,7 @@ void cRecordingUserCommand::InvokeCommand(const char *State, const char *Recordi char *cmd; asprintf(&cmd, "%s %s '%s'", command, State, RecordingFileName); isyslog(LOG_INFO, "executing '%s'", cmd); - system(cmd); + SystemExec(cmd); delete cmd; } } |