summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-02-03 15:55:04 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-02-03 15:55:04 +0100
commitdeb9f887106521797cacd77f1ae48de1d7b3277e (patch)
treeca79d7e3988bed90e1f18bcc9b39cecee67a91c7 /recording.c
parent0b7e9057daceab33b13238f4dea90976b5d2074d (diff)
downloadvdr-deb9f887106521797cacd77f1ae48de1d7b3277e.tar.gz
vdr-deb9f887106521797cacd77f1ae48de1d7b3277e.tar.bz2
Implemented TITLE and EPISODE keywords
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/recording.c b/recording.c
index acdf264c..7a55e1a7 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.48 2002/01/27 15:14:45 kls Exp $
+ * $Id: recording.c 1.49 2002/02/03 15:46:42 kls Exp $
*/
#include "recording.h"
@@ -41,6 +41,9 @@
#define DISKCHECKDELTA 100 // seconds between checks for free disk space
#define REMOVELATENCY 10 // seconds to wait until next check after removing a file
+#define TIMERMACRO_TITLE "TITLE"
+#define TIMERMACRO_EPISODE "EPISODE"
+
void RemoveDeletedRecordings(void)
{
static time_t LastRemoveCheck = 0;
@@ -214,19 +217,33 @@ char *ExchangeChars(char *s, bool ToFileSystem)
return s;
}
-cRecording::cRecording(cTimer *Timer, const char *Subtitle, const char *Summary)
+cRecording::cRecording(cTimer *Timer, const char *Title, const char *Subtitle, const char *Summary)
{
resume = RESUME_NOT_INITIALIZED;
titleBuffer = NULL;
sortBuffer = NULL;
fileName = NULL;
- if (Timer->IsSingleEvent() || !Setup.UseSubtitle)
+ name = NULL;
+ // set up the actual name:
+ if (isempty(Title))
+ Title = Channels.GetChannelNameByNumber(Timer->channel);
+ if (isempty(Subtitle))
+ Subtitle = " ";
+ char *macroTITLE = strstr(Timer->file, TIMERMACRO_TITLE);
+ char *macroEPISODE = strstr(Timer->file, TIMERMACRO_EPISODE);
+ if (macroTITLE || macroEPISODE) {
name = strdup(Timer->file);
- else {
- if (isempty(Subtitle))
- Subtitle = " ";
- asprintf(&name, "%s~%s", Timer->file, Subtitle);
+ name = strreplace(name, TIMERMACRO_TITLE, Title);
+ name = strreplace(name, TIMERMACRO_EPISODE, Subtitle);
+ if (Timer->IsSingleEvent()) {
+ Timer->SetFile(name); // this was an instant recording, so let's set the actual data
+ Timers.Save();
+ }
}
+ else if (Timer->IsSingleEvent() || !Setup.UseSubtitle)
+ name = strdup(Timer->file);
+ else
+ asprintf(&name, "%s~%s", Timer->file, Subtitle);
// substitute characters that would cause problems in file names:
strreplace(name, '\n', ' ');
start = Timer->StartTime();