From da376c060349470a5c54753f66bb0305746b8f78 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 17 Jun 2007 13:13:47 +0200 Subject: [PATCH] The info.vdr file now also stores the name of the channel --- CONTRIBUTORS | 1 + HISTORY | 3 +++ recording.c | 11 ++++++++--- recording.h | 4 +++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9fdb083c..826fe3ed 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1926,6 +1926,7 @@ Alexander Hans to be drawn with a transparent background for reporting that the "'1' for encrypted radio channels" part in the description of the VPID in vdr.5 is obsolete + for a patch that was used to implement storing the channel name in info.vdr Daniel Karsubka for suggesting to write the epg.data file when VDR exits diff --git a/HISTORY b/HISTORY index ef821290..c0902310 100644 --- a/HISTORY +++ b/HISTORY @@ -5252,3 +5252,6 @@ Video Disk Recorder Revision History - 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). diff --git a/recording.c b/recording.c index f2a617f2..22bb9556 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.153 2007/06/16 09:36:08 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); diff --git a/recording.h b/recording.h index f9db505d..045bb24f 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.56 2006/12/01 15:06:07 kls Exp $ + * $Id: recording.h 1.57 2007/06/17 12:53:05 kls Exp $ */ #ifndef __RECORDING_H @@ -42,6 +42,7 @@ class cRecordingInfo { friend class cRecording; private: tChannelID channelID; + char *channelName; const cEvent *event; cEvent *ownEvent; char *aux; @@ -51,6 +52,7 @@ private: public: ~cRecordingInfo(); tChannelID ChannelID(void) const { return channelID; } + const char *ChannelName(void) const { return channelName; } const char *Title(void) const { return event->Title(); } const char *ShortText(void) const { return event->ShortText(); } const char *Description(void) const { return event->Description(); }