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

VFAT switch exchanges ':' in recording names; modified exchanging characters

This commit is contained in:
Klaus Schmidinger 2001-06-16 10:36:13 +02:00
parent 7caf38b527
commit ef0aba26bd
2 changed files with 26 additions and 14 deletions

View File

@ -506,7 +506,7 @@ Video Disk Recorder Revision History
- Fixed removing recordings with Lifetime = 99. - Fixed removing recordings with Lifetime = 99.
- Improved channel switching. - Improved channel switching.
2001-06-15: Version 0.82 2001-06-16: Version 0.82
- Increased timeout until reporting "broken video data stream" when recording. - Increased timeout until reporting "broken video data stream" when recording.
- Modified method of turning off PIDs when switching channel. - Modified method of turning off PIDs when switching channel.
@ -528,3 +528,5 @@ Video Disk Recorder Revision History
to multiplex smoothly with the video data. to multiplex smoothly with the video data.
- Fixed a bug in the editing mechanism (didn't work with recordings that - Fixed a bug in the editing mechanism (didn't work with recordings that
consist of more than one data file). consist of more than one data file).
- The compile time switch VFAT has been fixed to recognize the ':' character
in recording names, too.

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.31 2001/06/12 15:31:32 kls Exp $ * $Id: recording.c 1.32 2001/06/16 10:33:20 kls Exp $
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -177,18 +177,31 @@ void cResumeFile::Delete(void)
// --- cRecording ------------------------------------------------------------ // --- cRecording ------------------------------------------------------------
struct tCharExchange { char a; char b; };
tCharExchange CharExchange[] = {
{ ' ', '_' },
{ '\'', '\x01' },
{ '/', '\x02' },
#ifdef VFAT
{ ':', '\x03' },
#endif
{ 0, 0 }
};
char *ExchangeChars(char *s, bool ToFileSystem)
{
for (struct tCharExchange *ce = CharExchange; ce->a && ce->b; ce++)
strreplace(s, ToFileSystem ? ce->a : ce->b, ToFileSystem ? ce->b : ce->a);
return s;
}
cRecording::cRecording(cTimer *Timer) cRecording::cRecording(cTimer *Timer)
{ {
titleBuffer = NULL; titleBuffer = NULL;
fileName = NULL; fileName = NULL;
name = strdup(Timer->file); name = strdup(Timer->file);
// substitute characters that would cause problems in file names: // substitute characters that would cause problems in file names:
for (char *p = name; *p; p++) { strreplace(name, '\n', ' ');
switch (*p) {
case '\n': *p = ' '; break;
case '/': *p = '-'; break;
}
}
summary = Timer->summary ? strdup(Timer->summary) : NULL; summary = Timer->summary ? strdup(Timer->summary) : NULL;
if (summary) if (summary)
strreplace(summary, '|', '\n'); strreplace(summary, '|', '\n');
@ -218,8 +231,7 @@ cRecording::cRecording(const char *FileName)
name = new char[p - FileName + 1]; name = new char[p - FileName + 1];
strncpy(name, FileName, p - FileName); strncpy(name, FileName, p - FileName);
name[p - FileName] = 0; name[p - FileName] = 0;
strreplace(name, '_', ' '); ExchangeChars(name, false);
strreplace(name, '\x01', '\'');
} }
// read an optional summary file: // read an optional summary file:
char *SummaryFileName = NULL; char *SummaryFileName = NULL;
@ -269,11 +281,9 @@ const char *cRecording::FileName(void)
{ {
if (!fileName) { if (!fileName) {
struct tm *t = localtime(&start); struct tm *t = localtime(&start);
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); asprintf(&fileName, NAMEFORMAT, VideoDirectory, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, priority, lifetime);
if (fileName) { ExchangeChars(name, false);
strreplace(fileName, ' ', '_');
strreplace(fileName, '\'', '\x01');
}
} }
return fileName; return fileName;
} }