Project

General

Profile

Feature #1805 ยป 0001-add-epg-source-channel-alias.patch

adds optional alias field to source channel names - Zoolooc, 04/24/2014 02:38 PM

View differences:

README
similar to the name of the source)
The second line shows the maximum days which will be provided.
The next lines are unique channelnames, provided by the source.
If those names provided by the source are not meaningful when displayed
in the OSD, an alias with utf-8 encoding can be added separated by the '|'
character (see examples below).
There can be application dependend data after each channelname. Note,
that the plugin/VDR must be able to read this control file.
......
sat1.de;005
nickcomedy;190:417
file;01:15;0;0
8
10001.port.ro|TVR 1
10002.port.ro|TVR 2
10003.port.ro|HBO
10015.port.ro|TVR International
setup.cpp
}
}
}
cString buffer = cString::sprintf("%s:\t%s",channels[i],mapped ? tr("mapped") : "");
cString buffer = cString::sprintf("%s:\t%s",extchannels[i],mapped ? tr("mapped") : "");
Add(new cOsdItem(buffer),true);
}
mappingEnd=Current();
......
void cMenuSetupXmltv2vdr::generatesumchannellist()
{
channels.Clear();
extchannels.Clear();
if (!g->EPGSources()->Count()) return;
for (int i=0; i<g->EPGSources()->Count()-1; i++)
{
......
if (!found)
{
channels.Append(strdup(channellist->Get(x)->Name()));
extchannels.Append(strdup(channellist->Get(x)->NameExtended()));
}
}
}
......
}
}
channels.Sort();
extchannels.Sort();
}
void cMenuSetupXmltv2vdr::Store(void)
......
{
sel[i]=0;
}
Add(new cMenuEditBoolItem(channellist->Get(i)->Name(),&sel[i],"",tr("selected")));
Add(new cMenuEditBoolItem(channellist->Get(i)->NameExtended(),&sel[i],"",tr("selected")));
}
Display();
}
......
flags=0;
if (Index>menu->ChannelList()->Size()) return;
const char *channel=(*menu->ChannelList())[Index];
if (!channel) return;
const char *extchannel=(*menu->ChannelListExtended())[Index];
if (!channel || !extchannel) return;
SetPlugin(plugin);
......
}
if (!lmap) return;
title=cString::sprintf("%s - %s '%s' : %s",trVDR("Setup"),trVDR("Plugin"),plugin->Name(), channel);
title=cString::sprintf("%s - %s '%s' : %s",trVDR("Setup"),trVDR("Plugin"),plugin->Name(), extchannel);
SetTitle(title);
flags=lmap->Flags();
setup.h
virtual void Store(void);
private:
cStringList channels;
cStringList extchannels;
cGlobals *g;
cMenuSetupXmltv2vdrChannelSource *cs;
cMenuSetupXmltv2vdrChannelMap *cm;
......
{
return &channels;
}
cStringList *ChannelListExtended()
{
return &extchannels;
}
};
class cMenuSetupXmltv2vdrTextMap : public cMenuSetupPage
source.cpp
#include "extpipe.h"
#include "debug.h"
cEPGChannel::cEPGChannel(const char *Name, bool InUse)
cEPGChannel::cEPGChannel(const char *Name, const char *ExtName, bool InUse)
{
name=strdup(Name);
inuse=InUse;
extname=strdup(ExtName);
}
cEPGChannel::~cEPGChannel()
{
if (name) free((void *) name);
if (extname) free((void *) extname);
}
int cEPGChannel::Compare(const cListObject &ListObject) const
......
// backward compatibility
cname++;
}
char *pipechar=strchr(line,'|');
char *extra=0;
char extname[256]="";
if (pipechar)
{
*pipechar=0;
pipechar++;
extra=pipechar;
dsyslogs(this,"found channel with extended name %s,%s",cname,extra);
sprintf(extname, "%s | %s", cname, extra);
}
if (!strchr(cname,' ') && (strlen(cname)>0))
{
cEPGChannel *epgchannel= new cEPGChannel(cname,false);
cEPGChannel *epgchannel= new cEPGChannel(cname,pipechar?extname:cname,false);
if (epgchannel) channels.Add(epgchannel);
}
}
source.h
private:
bool inuse;
const char *name;
const char *extname;
public:
cEPGChannel(const char *Name, bool InUse=false);
cEPGChannel(const char *Name, const char *ExtName, bool InUse=false);
~cEPGChannel();
virtual int Compare(const cListObject &ListObject) const;
bool InUse()
......
{
return name;
}
const char *NameExtended()
{
return extname;
}
};
class cEPGChannels : public cList<cEPGChannel> {};
    (1-1/1)