diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-09-02 15:21:54 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-09-02 15:21:54 +0200 |
commit | 22ccf22f6f4c2dd94e322f0aebf134a90b310fae (patch) | |
tree | 5d6d38dc2b94ff37150f38b3248636ae5e1cfd5a | |
parent | 0d7571054579614f9278999077921942ca08a7bf (diff) | |
download | vdr-22ccf22f6f4c2dd94e322f0aebf134a90b310fae.tar.gz vdr-22ccf22f6f4c2dd94e322f0aebf134a90b310fae.tar.bz2 |
Using subtitle for repeating timers; taking summary at recording time
-rw-r--r-- | HISTORY | 15 | ||||
-rw-r--r-- | MANUAL | 14 | ||||
-rw-r--r-- | config.c | 20 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | i18n.c | 11 | ||||
-rw-r--r-- | menu.c | 13 | ||||
-rw-r--r-- | recording.c | 25 | ||||
-rw-r--r-- | recording.h | 4 | ||||
-rw-r--r-- | videodir.c | 22 |
9 files changed, 89 insertions, 38 deletions
@@ -701,3 +701,18 @@ Video Disk Recorder Revision History been chosen since the file system's directory delimiter '/' may be part of a regular programme name (showing the directory hierarchy in the "Recordings" menu will follow later). +- Repeating timers now create recordings that contain the 'Subtitle' information + from the EPG data in their file name. Typically (on tv stations that care + about their viewers) this contains the episode title of a series. The + subtitle is appended to the timer's file name, separated by a '~' character, + so that it results in all recordings of this timer being collected in a + common subdirectory. You can disable this with the 'UseSubtitle' parameter + in the "Setup" menu. +- The summary information is now taken from the EPG data at the actual time of + recording (no longer at the time the timer is created in the "Schedule" menu). + If a timer already has summary data, that data will be used. If you have + repeating timers in your 'timers.conf', you may want to make sure they do + NOT contain any summary information (that's the last field in the timer + definitions). Use your favourite text editor to delete that information. + That way every recording will store the actual summary data at the time of + the recording. @@ -291,6 +291,12 @@ Video Disk Recorder User's Manual structure "/video/Sci-Fi/Star_Trek/Voyager". The '~' character has been chosen for this since the file system's directory delimiter '/' may be part of a regular programme name. + Repeating timers create recordings that contain the 'Subtitle' + information from the EPG data in their file name. Typically (on tv + stations that care about their viewers) this contains the episode + title of a series. The subtitle is appended to the timer's file name, + separated by a '~' character, so that it results in all recordings + of this timer being collected in a common subdirectory. If this field is left blank, the channel name will be used to form the name of the recording. @@ -408,6 +414,14 @@ Video Disk Recorder User's Manual means that this recording will never be deleted automatically. + UseSubtitle = 1 Repeating timers use the EPG's 'Subtitle' information to + create recording file names in a hierarchical structure + (for instance to gather all episodes of a series in a + common subdirectory). This parameter can be used to + control this. + 0 = don't use the 'Subtitle' + 1 = use it (and create subdirectories) + VideoFormat = 0 The video format (or aspect ratio) of the tv set in use. 0 = 4:3 1 = 16:9 @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.63 2001/09/01 15:17:44 kls Exp $ + * $Id: config.c 1.64 2001/09/02 15:04:13 kls Exp $ */ #include "config.h" @@ -365,21 +365,6 @@ cTimer::cTimer(const cEventInfo *EventInfo) if (!isempty(Title)) strn0cpy(file, EventInfo->GetTitle(), sizeof(file)); summary = NULL; - const char *Subtitle = EventInfo->GetSubtitle(); - if (isempty(Subtitle)) - Subtitle = ""; - const char *Summary = EventInfo->GetExtendedDescription(); - if (isempty(Summary)) - Summary = ""; - if (*Subtitle || *Summary) { - asprintf(&summary, "%s%s%s", Subtitle, (*Subtitle && *Summary) ? "\n\n" : "", Summary); - char *p = summary; - while (*p) { - if (*p == '\n') - *p = '|'; - p++; - } - } } cTimer::~cTimer() @@ -815,6 +800,7 @@ cSetup::cSetup(void) PrimaryLimit = 0; DefaultPriority = 50; DefaultLifetime = 50; + UseSubtitle = 1; VideoFormat = VIDEO_FORMAT_4_3; ChannelInfoPos = 0; OSDwidth = 52; @@ -851,6 +837,7 @@ bool cSetup::Parse(char *s) else if (!strcasecmp(Name, "PrimaryLimit")) PrimaryLimit = atoi(Value); else if (!strcasecmp(Name, "DefaultPriority")) DefaultPriority = atoi(Value); else if (!strcasecmp(Name, "DefaultLifetime")) DefaultLifetime = atoi(Value); + else if (!strcasecmp(Name, "UseSubtitle")) UseSubtitle = atoi(Value); else if (!strcasecmp(Name, "VideoFormat")) VideoFormat = atoi(Value); else if (!strcasecmp(Name, "ChannelInfoPos")) ChannelInfoPos = atoi(Value); else if (!strcasecmp(Name, "OSDwidth")) OSDwidth = atoi(Value); @@ -922,6 +909,7 @@ bool cSetup::Save(const char *FileName) fprintf(f, "PrimaryLimit = %d\n", PrimaryLimit); fprintf(f, "DefaultPriority = %d\n", DefaultPriority); fprintf(f, "DefaultLifetime = %d\n", DefaultLifetime); + fprintf(f, "UseSubtitle = %d\n", UseSubtitle); fprintf(f, "VideoFormat = %d\n", VideoFormat); fprintf(f, "ChannelInfoPos = %d\n", ChannelInfoPos); fprintf(f, "OSDwidth = %d\n", OSDwidth); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.70 2001/09/01 15:16:42 kls Exp $ + * $Id: config.h 1.71 2001/09/02 15:03:19 kls Exp $ */ #ifndef __CONFIG_H @@ -292,6 +292,7 @@ public: int SortTimers; int PrimaryLimit; int DefaultPriority, DefaultLifetime; + int UseSubtitle; int VideoFormat; int ChannelInfoPos; int OSDwidth, OSDheight; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.38 2001/09/01 15:20:45 kls Exp $ + * $Id: i18n.c 1.39 2001/09/02 15:17:33 kls Exp $ * * Slovenian translations provided by Miha Setina <mihasetina@softhome.net> * Italian translations provided by Alberto Carraro <bertocar@tin.it> @@ -857,6 +857,15 @@ const tPhrase Phrases[] = { "Durée de vie par défaut", "Normal levetid (Timer)", }, + { "UseSubtitle", + "Subtitle verwenden", + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + }, { "VideoFormat", "Video Format", "", // TODO @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.113 2001/09/02 10:00:40 kls Exp $ + * $Id: menu.c 1.114 2001/09/02 15:04:41 kls Exp $ */ #include "menu.h" @@ -1727,6 +1727,7 @@ void cMenuSetup::Set(void) Add(new cMenuEditIntItem( tr("PrimaryLimit"), &data.PrimaryLimit, 0, MAXPRIORITY)); Add(new cMenuEditIntItem( tr("DefaultPriority"), &data.DefaultPriority, 0, MAXPRIORITY)); Add(new cMenuEditIntItem( tr("DefaultLifetime"), &data.DefaultLifetime, 0, MAXLIFETIME)); + Add(new cMenuEditBoolItem(tr("UseSubtitle"), &data.UseSubtitle)); Add(new cMenuEditBoolItem(tr("VideoFormat"), &data.VideoFormat, "4:3", "16:9")); Add(new cMenuEditBoolItem(tr("ChannelInfoPos"), &data.ChannelInfoPos, tr("bottom"), tr("top"))); Add(new cMenuEditIntItem( tr("OSDwidth"), &data.OSDwidth, MINOSDWIDTH, MAXOSDWIDTH)); @@ -2100,12 +2101,14 @@ cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer) timer->SetPending(true); timer->SetRecording(true); if (Channels.SwitchTo(timer->channel, dvbApi)) { + const char *Subtitle = NULL; + const char *Summary = NULL; if (GetEventInfo()) { - //XXX this is in preparation for storing recordings in subdirectories and giving them the name of the Subtitle - dsyslog(LOG_INFO, "Title: '%s' Subtitle: '%s'", eventInfo->GetTitle(), eventInfo->GetSubtitle());//XXX - //XXX modify timer's name and summary, mark it as modified (revert later when stopping) + dsyslog(LOG_INFO, "Title: '%s' Subtitle: '%s'", eventInfo->GetTitle(), eventInfo->GetSubtitle()); + Subtitle = eventInfo->GetSubtitle(); + Summary = eventInfo->GetExtendedDescription(); } - cRecording Recording(timer); + cRecording Recording(timer, Subtitle, Summary); if (dvbApi->StartRecord(Recording.FileName(), Channels.GetByNumber(timer->channel)->ca, timer->priority)) Recording.WriteSummary(); Interface->DisplayRecording(dvbApi->CardIndex(), true); diff --git a/recording.c b/recording.c index c98d5252..f6573781 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.35 2001/09/02 10:25:12 kls Exp $ + * $Id: recording.c 1.36 2001/09/02 15:09:28 kls Exp $ */ #define _GNU_SOURCE @@ -204,19 +204,32 @@ char *ExchangeChars(char *s, bool ToFileSystem) return s; } -cRecording::cRecording(cTimer *Timer) +cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary) { titleBuffer = NULL; fileName = NULL; - name = strdup(Timer->file); + if (Timer->IsSingleEvent() || !Setup.UseSubtitle) + name = strdup(Timer->file); + else { + if (isempty(Subtitle)) + Subtitle = " "; + asprintf(&name, "%s~%s", Timer->file, Subtitle); + } // substitute characters that would cause problems in file names: strreplace(name, '\n', ' '); - summary = Timer->summary ? strdup(Timer->summary) : NULL; - if (summary) - strreplace(summary, '|', '\n'); start = Timer->StartTime(); priority = Timer->priority; lifetime = Timer->lifetime; + // handle summary: + summary = !isempty(Timer->summary) ? strdup(Timer->summary) : NULL; + if (!summary) { + if (isempty(Subtitle)) + Subtitle = ""; + if (isempty(Summary)) + Summary = ""; + if (*Subtitle || *Summary) + asprintf(&summary, "%s%s%s", Subtitle, (*Subtitle && *Summary) ? "\n\n" : "", Summary); + } } cRecording::cRecording(const char *FileName) diff --git a/recording.h b/recording.h index 87cf8395..e1af3db3 100644 --- a/recording.h +++ b/recording.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.h 1.15 2001/09/01 12:58:02 kls Exp $ + * $Id: recording.h 1.16 2001/09/02 11:35:56 kls Exp $ */ #ifndef __RECORDING_H @@ -39,7 +39,7 @@ public: time_t start; int priority; int lifetime; - cRecording(cTimer *Timer); + cRecording(cTimer *Timer, const char *Subtitle, const char *Summary); cRecording(const char *FileName); ~cRecording(); const char *FileName(void); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: videodir.c 1.5 2001/05/01 09:48:57 kls Exp $ + * $Id: videodir.c 1.6 2001/09/02 14:55:15 kls Exp $ */ #include "videodir.h" @@ -188,13 +188,21 @@ const char *PrefixVideoFileName(const char *FileName, char Prefix) if (!PrefixedName || strlen(PrefixedName) <= strlen(FileName)) PrefixedName = (char *)realloc(PrefixedName, strlen(FileName) + 2); if (PrefixedName) { - strcpy(PrefixedName, VideoDirectory); - char *p = PrefixedName + strlen(PrefixedName); - *p++ = '/'; - *p++ = Prefix; - strcpy(p, FileName + strlen(VideoDirectory) + 1); + const char *p = FileName + strlen(FileName); // p points at the terminating 0 + int n = 2; + while (p-- > FileName && n > 0) { + if (*p == '/') { + if (--n == 0) { + int l = p - FileName + 1; + strncpy(PrefixedName, FileName, l); + PrefixedName[l] = Prefix; + strcpy(PrefixedName + l + 1, p + 1); + return PrefixedName; + } + } + } } - return PrefixedName; + return NULL; } void RemoveEmptyVideoDirectories(void) |