diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-06-16 10:36:13 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-06-16 10:36:13 +0200 |
commit | ef0aba26bd3c9ca59fb4c0c451db78031a2d180d (patch) | |
tree | 552b064c6973f4f14ab28da7c402c377879d6b3c | |
parent | 7caf38b527270f02960300a4eb13e44b7431c191 (diff) | |
download | vdr-ef0aba26bd3c9ca59fb4c0c451db78031a2d180d.tar.gz vdr-ef0aba26bd3c9ca59fb4c0c451db78031a2d180d.tar.bz2 |
VFAT switch exchanges ':' in recording names; modified exchanging characters
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | recording.c | 36 |
2 files changed, 26 insertions, 14 deletions
@@ -506,7 +506,7 @@ Video Disk Recorder Revision History - Fixed removing recordings with Lifetime = 99. - 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. - 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. - Fixed a bug in the editing mechanism (didn't work with recordings that consist of more than one data file). +- The compile time switch VFAT has been fixed to recognize the ':' character + in recording names, too. diff --git a/recording.c b/recording.c index 6b35ef29..ddca1a4b 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.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 @@ -177,18 +177,31 @@ void cResumeFile::Delete(void) // --- 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) { titleBuffer = NULL; fileName = NULL; name = strdup(Timer->file); // substitute characters that would cause problems in file names: - for (char *p = name; *p; p++) { - switch (*p) { - case '\n': *p = ' '; break; - case '/': *p = '-'; break; - } - } + strreplace(name, '\n', ' '); summary = Timer->summary ? strdup(Timer->summary) : NULL; if (summary) strreplace(summary, '|', '\n'); @@ -218,8 +231,7 @@ cRecording::cRecording(const char *FileName) name = new char[p - FileName + 1]; strncpy(name, FileName, p - FileName); name[p - FileName] = 0; - strreplace(name, '_', ' '); - strreplace(name, '\x01', '\''); + ExchangeChars(name, false); } // read an optional summary file: char *SummaryFileName = NULL; @@ -269,11 +281,9 @@ const char *cRecording::FileName(void) { if (!fileName) { 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); - if (fileName) { - strreplace(fileName, ' ', '_'); - strreplace(fileName, '\'', '\x01'); - } + ExchangeChars(name, false); } return fileName; } |