summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2007-06-17 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2007-06-17 18:00:00 +0200
commitb1e4da3be6552f58f3890bf2ad48879823d2e130 (patch)
treecf42a1e6b296956b82a2820948c7b90dbcddf26e /recording.c
parentb9b9ace9a8d2d1c0beda1dc0a2ebc6be9b47c305 (diff)
downloadvdr-patch-lnbsharing-b1e4da3be6552f58f3890bf2ad48879823d2e130.tar.gz
vdr-patch-lnbsharing-b1e4da3be6552f58f3890bf2ad48879823d2e130.tar.bz2
Version 1.5.4vdr-1.5.4
- Increased APIVERSION (forgot to do that in 1.5.2 and 1.5.3). - Fixed a crash in i18n character set conversion (thanks to Alexander Riedel, Jose Alberto Reguero and Christian Wieninger for patches that cured part of the problem). - Adjusted the 'skincurses' plugin to UTF-8 handling. - Using nl_langinfo(CODESET) to determine the local codeset to use (thanks to Thomas Günther). The codeset names in 'libsi/si.c' have been changed to the canonical spelling with '-' (thanks to Ludwig Nussel for pointing this out). - Modified handling invalid characters in VFAT mode. - Replaced strn0cpy() with Utf8Strn0Cpy() where necessary. - Now using 'fontconfig' to determine which fonts to use (thanks to Anssi Hannula for code and hints on how to do this). - If no fonts are installed, VDR now uses a dummy font that doesn't actually draw any text, and logs an error message. - The new function cFont::CreateFont() can be used by plugins to create and use fonts of their own, independent of VDR's standard fonts. - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Changed the parameter "OSD font" to "Default font" in "Setup/OSD" (suggested by Rolf Ahrenberg). - Fixed handling detached processes in SystemExec() (thanks to Udo Richter). - The info.vdr file now also stores the name of the channel, and the new function cRecordingInfo::ChannelName() returns this information if available (based on a patch from Alexander Hans). - The new function cOsd::SetOsdPosition() can be used to dynamically change the position and size of the OSD (based on a request from Christoph Haubrich). Plugins that implement skins should no longer use Setup.OSDWidth etc. directly, but should rather use cOsd::OsdWidth() etc. instead. Currently a change to the OSD position will only apply to newly opened OSDs.
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/recording.c b/recording.c
index 5298de3..22bb955 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.151 2006/10/07 12:46:22 kls Exp $
+ * $Id: recording.c 1.154 2007/06/17 13:10:12 kls Exp $
*/
#include "recording.h"
@@ -262,6 +262,7 @@ void cResumeFile::Delete(void)
cRecordingInfo::cRecordingInfo(const cChannel *Channel, const cEvent *Event)
{
channelID = Channel ? Channel->GetChannelID() : tChannelID::InvalidID;
+ channelName = Channel ? strdup(Channel->Name()) : NULL;
ownEvent = Event ? NULL : new cEvent(0);
event = ownEvent ? ownEvent : Event;
aux = NULL;
@@ -304,6 +305,7 @@ cRecordingInfo::~cRecordingInfo()
{
delete ownEvent;
free(aux);
+ free(channelName);
}
void cRecordingInfo::SetData(const char *Title, const char *ShortText, const char *Description)
@@ -334,8 +336,11 @@ bool cRecordingInfo::Read(FILE *f)
switch (*s) {
case 'C': {
char *p = strchr(t, ' ');
- if (p)
+ if (p) {
+ free(channelName);
+ asprintf(&channelName, "%s", compactspace(p));
*p = 0; // strips optional channel name
+ }
if (*t)
channelID = tChannelID::FromString(t);
}
@@ -375,7 +380,7 @@ bool cRecordingInfo::Read(FILE *f)
bool cRecordingInfo::Write(FILE *f, const char *Prefix) const
{
if (channelID.Valid())
- fprintf(f, "%sC %s\n", Prefix, *channelID.ToString());
+ fprintf(f, "%sC %s%s%s\n", Prefix, *channelID.ToString(), channelName ? " " : "", channelName ? channelName : "");
event->Dump(f, Prefix, true);
if (aux)
fprintf(f, "%s@ %s\n", Prefix, aux);
@@ -406,34 +411,14 @@ char *ExchangeChars(char *s, bool ToFileSystem)
// The VFAT file system can't handle all characters, so we
// have to take extra efforts to encode/decode them:
if (ToFileSystem) {
+ const char *InvalidChars = "\"\\/:*?|<>#";
switch (*p) {
- // characters that can be used "as is":
- case '!':
- case '@':
- case '$':
- case '%':
- case '&':
- case '(':
- case ')':
- case '+':
- case ',':
- case '-':
- case ';':
- case '=':
- case '0' ... '9':
- case 'a' ... 'z':
- case 'A' ... 'Z':
- case 'ä': case 'Ä':
- case 'ö': case 'Ö':
- case 'ü': case 'Ü':
- case 'ß':
- break;
// characters that can be mapped to other characters:
case ' ': *p = '_'; break;
case '~': *p = '/'; break;
// characters that have to be encoded:
default:
- if (*p != '.' || !*(p + 1) || *(p + 1) == '~') { // Windows can't handle '.' at the end of directory names
+ if (strchr(InvalidChars, *p) || *p == '.' && (!*(p + 1) || *(p + 1) == '~')) { // Windows can't handle '.' at the end of file/directory names
int l = p - s;
s = (char *)realloc(s, strlen(s) + 10);
p = s + l;
@@ -450,7 +435,7 @@ char *ExchangeChars(char *s, bool ToFileSystem)
// mapped characters:
case '_': *p = ' '; break;
case '/': *p = '~'; break;
- // encodes characters:
+ // encoded characters:
case '#': {
if (strlen(p) > 2) {
char buf[3];
@@ -500,7 +485,7 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
Subtitle = " ";
else if (strlen(Subtitle) > MAX_SUBTITLE_LENGTH) {
// let's make sure the Subtitle doesn't produce too long a file name:
- strn0cpy(SubtitleBuffer, Subtitle, MAX_SUBTITLE_LENGTH);
+ Utf8Strn0Cpy(SubtitleBuffer, Subtitle, MAX_SUBTITLE_LENGTH);
Subtitle = SubtitleBuffer;
}
char *macroTITLE = strstr(Timer->File(), TIMERMACRO_TITLE);