summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-02-10 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-02-10 18:00:00 +0100
commita1da0e5c5de55009716e2c327dda16c61c1dae83 (patch)
tree73148d197061f65d2f6d29b56b55b77f9428c17d /recording.c
parentef0a53af7282b14bd40f2087de28fc12a94e672b (diff)
downloadvdr-patch-lnbsharing-a1da0e5c5de55009716e2c327dda16c61c1dae83.tar.gz
vdr-patch-lnbsharing-a1da0e5c5de55009716e2c327dda16c61c1dae83.tar.bz2
Version 0.99vdr-0.99
- Fixed a bug in moving timers or channels to the last position in the list (thanks to Matthias Schniedermeyer for helping to debug this one). - Changed the estimated data rate for calculating the remaining disk capacity to 25.75 MB/min. - Only reporting the 'EPG bugfix statistics' if there really were any fixes. - Added Finnish language texts (thanks to Hannu Savolainen). - Reverted to the previous way of searching for the EPG record of the current recording in case of a periodic timer (i.e. taking the one that is in the middle between start and end time). - Added a typedef for 'in_addr_t' to make it work with glibc < 2.2 (thanks to Jürgen Schmidt). - When the last entry in a "Recordings" menu page is deleted, that page is now automatically closed (suggested by Uwe Freese). - Changed the default name for instant recordings to "TITLE EPISODE" (avoiding the '-'). - If Setup.ShowInfoOnChSwitch is set to "no", the box for the EPG display is no longer shown (thanks to Andy Grobb). - If compiled with VFAT=1, characters that can't be handled by a VFAT system are now encoded to '#XX'. - When the user presses the "Power" button and there is a timer about to start recording within Setup.MinEventTimeout minutes, there is now a confirmation prompt telling the user that there is an upcoming timer event. - If a recording has no episode title, the trailing '~' is no longer shown in the progress display.
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c83
1 files changed, 74 insertions, 9 deletions
diff --git a/recording.c b/recording.c
index 7a55e1a..d822887 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.49 2002/02/03 15:46:42 kls Exp $
+ * $Id: recording.c 1.51 2002/02/10 15:41:23 kls Exp $
*/
#include "recording.h"
@@ -196,22 +196,82 @@ tCharExchange CharExchange[] = {
{ ' ', '_' },
{ '\'', '\x01' },
{ '/', '\x02' },
-#ifdef VFAT
- { ':', '\x03' },
-#endif
{ 0, 0 }
};
-char *ExchangeChars(char *s, bool ToFileSystem)
+static char *ExchangeChars(char *s, bool ToFileSystem)
{
char *p = s;
while (*p) {
+#define VFAT 1
+#ifdef VFAT
+ // The VFAT file system can't handle all characters, so we
+ // have to take extra efforts to encode/decode them:
+ if (ToFileSystem) {
+ switch (*p) {
+ // characters that can be used "as is":
+ case '!':
+ case '@':
+ case '$':
+ case '%':
+ case '&':
+ case '(':
+ case ')':
+ case '+':
+ case ',':
+ case '-':
+ case '.':
+ case ';':
+ case '=':
+ case '0' ... '9':
+ case 'a' ... 'z':
+ case 'A' ... 'Z': break;
+ // characters that can be mapped to other characters:
+ case ' ': *p = '_'; break;
+ case '~': *p = '/'; break;
+ // characters that have to be encoded:
+ default: {
+ int l = p - s;
+ s = (char *)realloc(s, strlen(s) + 10);
+ p = s + l;
+ char buf[4];
+ sprintf(buf, "#%02X", (unsigned char)*p);
+ memmove(p + 2, p, strlen(p) + 1);
+ strncpy(p, buf, 3);
+ p += 2;
+ }
+ }
+ }
+ else {
+ switch (*p) {
+ // mapped characters:
+ case '_': *p = ' '; break;
+ case '/': *p = '~'; break;
+ // encodes characters:
+ case '#': {
+ if (strlen(p) > 2) {
+ char buf[3];
+ sprintf(buf, "%c%c", *(p + 1), *(p + 2));
+ unsigned char c = strtol(buf, NULL, 16);
+ *p = c;
+ memmove(p + 1, p + 3, strlen(p) - 2);
+ }
+ }
+ break;
+ // backwards compatibility:
+ case '\x01': *p = '\''; break;
+ case '\x02': *p = '/'; break;
+ case '\x03': *p = ':'; break;
+ }
+ }
+#else
for (struct tCharExchange *ce = CharExchange; ce->a && ce->b; ce++) {
if (*p == (ToFileSystem ? ce->a : ce->b)) {
*p = ToFileSystem ? ce->b : ce->a;
break;
}
}
+#endif
p++;
}
return s;
@@ -285,7 +345,7 @@ cRecording::cRecording(const char *FileName)
name = new char[p - FileName + 1];
strncpy(name, FileName, p - FileName);
name[p - FileName] = 0;
- ExchangeChars(name, false);
+ name = ExchangeChars(name, false);
}
// read an optional summary file:
char *SummaryFileName = NULL;
@@ -384,9 +444,9 @@ const char *cRecording::FileName(void)
if (!fileName) {
struct tm tm_r;
struct tm *t = localtime_r(&start, &tm_r);
- ExchangeChars(name, true);
+ name = 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);
+ name = ExchangeChars(name, false);
}
return fileName;
}
@@ -399,7 +459,7 @@ const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level)
if (Level < 0 || Level == HierarchyLevels()) {
struct tm tm_r;
struct tm *t = localtime_r(&start, &tm_r);
- const char *s;
+ char *s;
if (Level > 0 && (s = strrchr(name, '~')) != NULL)
s++;
else
@@ -413,6 +473,11 @@ const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level)
New,
Delimiter,
s);
+ // let's not display a trailing '~':
+ stripspace(titleBuffer);
+ s = &titleBuffer[strlen(titleBuffer) - 1];
+ if (*s == '~')
+ *s = 0;
}
else if (Level < HierarchyLevels()) {
const char *s = name;