Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] PATCH: Source dependant new channel insertation
Hi,
attached you will find a small patch, which lets vdr insert new found channels
after a source dependant group seperator (:New Channels @<Source>).
This is quite usefull in case you have more than one sources and exterm
usefull, if you have a moveable dish with the ability to receive many
sources ;-)
Klaus, may be you can consider to include this small patch in the next
release?
--
Viele Grüße
Christian
diff -Naur ../vdr-1.3.12.orig/channels.c ./channels.c
--- ../vdr-1.3.12.orig/channels.c 2004-04-03 15:42:06.000000000 +0200
+++ ./channels.c 2004-07-26 20:25:30.480867288 +0200
@@ -493,6 +493,11 @@
refChannel = RefChannel;
}
+void cChannel::SetGroupSep(bool Sep)
+{
+ groupSep = Sep;
+}
+
static int PrintParameter(char *p, char Name, int Value)
{
return Value >= 0 && Value != 999 ? sprintf(p, "%c%d", Name, Value) : 0;
@@ -847,6 +852,16 @@
return NULL;
}
+cChannel *cChannels::GetByName(char *Name)
+{
+ for (cChannel *channel = First(); channel; channel = Next(channel))
+ {
+ if (strcmp(channel->Name(), Name)==0)
+ return channel;
+ }
+ return NULL;
+}
+
bool cChannels::HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel)
{
tChannelID NewChannelID = NewChannel->GetChannelID();
@@ -880,7 +895,26 @@
if (Transponder) {
dsyslog("creating new channel '%s' on %s transponder %d with id %d-%d-%d-%d", Name, cSource::ToString(Transponder->Source()), Transponder->Transponder(), Nid, Tid, Sid, Rid);
cChannel *NewChannel = new cChannel(*Transponder);
+#if 0
Add(NewChannel);
+#else
+ /* find group seperator for the source of this channel */
+ {
+ char buffer[64];
+ snprintf(buffer, sizeof(buffer), "New Channels @ %s",
+ cSource::ToString(NewChannel->Source()) );
+ cChannel *groupSep = GetByName(buffer);
+ if(!groupSep) // group sepeator for this source doesn't exist, so lets
+ {
+ groupSep = new cChannel();
+ groupSep->SetName(buffer, true);
+ groupSep->SetGroupSep(true);
+ Add(groupSep);
+ }
+ Add(NewChannel, groupSep);
+ }
+#endif
+
ReNumber();
NewChannel->SetId(Nid, Tid, Sid, Rid, false);
NewChannel->SetName(Name, false);
diff -Naur ../vdr-1.3.12.orig/channels.h ./channels.h
--- ../vdr-1.3.12.orig/channels.h 2004-04-03 15:40:47.000000000 +0200
+++ ./channels.h 2004-07-26 20:25:57.309788672 +0200
@@ -173,6 +173,7 @@
void SetCaDescriptors(int Level);
void SetLinkChannels(cLinkChannels *LinkChannels);
void SetRefChannel(cChannel *RefChannel);
+ void SetGroupSep(bool Sep = true);
};
class cChannels : public cRwLock, public cConfig<cChannel> {
@@ -190,6 +191,7 @@
cChannel *GetByNumber(int Number, int SkipGap = 0);
cChannel *GetByServiceID(int Source, int Transponder, unsigned short ServiceID);
cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false);
+ cChannel *GetByName(char *Name);
int BeingEdited(void) { return beingEdited; }
void IncBeingEdited(void) { beingEdited++; }
void DecBeingEdited(void) { beingEdited--; }
Home |
Main Index |
Thread Index