summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2003-01-06 15:37:33 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2003-01-06 15:37:33 +0100
commitbcb0aca95408f1580c97375f3dde230bc788f40d (patch)
tree30b4d55cdf1f4539a5b4132e26330c8c520d32d8
parent4b1440737a1929ad56ed8ad4336cd090695de414 (diff)
downloadvdr-bcb0aca95408f1580c97375f3dde230bc788f40d.tar.gz
vdr-bcb0aca95408f1580c97375f3dde230bc788f40d.tar.bz2
Limiting Subtitle length when creating a recording file name from EPG data
-rw-r--r--HISTORY3
-rw-r--r--recording.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/HISTORY b/HISTORY
index 9a3ab20b..07b0f27d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1913,3 +1913,6 @@ Video Disk Recorder Revision History
2002-01-06 or higher (with the new firmware supporting the "Link Layer" protocol).
- Added an EPG bugfix that moves the Subtitle data to the Extended Description in
case the latter is empty and the Subtitle exceeds some useful length.
+- Since several channels put very long strings into the Subtitle part of their
+ EPG data, that string is now limited in length when used in a recording's
+ file name.
diff --git a/recording.c b/recording.c
index ebeaf763..e14bb437 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.71 2002/12/23 12:41:20 kls Exp $
+ * $Id: recording.c 1.72 2003/01/06 15:36:12 kls Exp $
*/
#include "recording.h"
@@ -58,6 +58,8 @@
#define TIMERMACRO_TITLE "TITLE"
#define TIMERMACRO_EPISODE "EPISODE"
+#define MAX_SUBTITLE_LENGTH 40
+
void RemoveDeletedRecordings(void)
{
static time_t LastRemoveCheck = 0;
@@ -306,10 +308,17 @@ cRecording::cRecording(cTimer *Timer, const char *Title, const char *Subtitle, c
fileName = NULL;
name = NULL;
// set up the actual name:
+ const char *OriginalSubtitle = Subtitle;
+ char SubtitleBuffer[MAX_SUBTITLE_LENGTH];
if (isempty(Title))
Title = Timer->Channel()->Name();
if (isempty(Subtitle))
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);
+ Subtitle = SubtitleBuffer;
+ }
char *macroTITLE = strstr(Timer->File(), TIMERMACRO_TITLE);
char *macroEPISODE = strstr(Timer->File(), TIMERMACRO_EPISODE);
if (macroTITLE || macroEPISODE) {
@@ -333,6 +342,7 @@ cRecording::cRecording(cTimer *Timer, const char *Title, const char *Subtitle, c
// handle summary:
summary = !isempty(Timer->Summary()) ? strdup(Timer->Summary()) : NULL;
if (!summary) {
+ Subtitle = OriginalSubtitle;
if (isempty(Subtitle))
Subtitle = "";
if (isempty(Summary))