The info.vdr file now also stores the name of the channel

This commit is contained in:
Klaus Schmidinger
2007-06-17 13:13:47 +02:00
parent efbb48dbaf
commit da376c0603
4 changed files with 15 additions and 4 deletions

View File

@@ -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);