1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00

Implement work-around for what vdr thinks are "duplicate" channels by

incrementing RID
This commit is contained in:
Antti Seppälä 2007-09-30 17:34:13 +00:00
parent 5d7b2310ef
commit e4f7904187

49
setup.c
View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: setup.c,v 1.14 2007/09/29 18:15:31 rahrenbe Exp $ * $Id: setup.c,v 1.15 2007/09/30 17:34:13 ajhseppa Exp $
*/ */
#include <string.h> #include <string.h>
@ -204,7 +204,50 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
if (Key == kOk) { if (Key == kOk) {
cChannel newchannel; cChannel newchannel;
SetChannelData(&newchannel); SetChannelData(&newchannel);
if (Channels.HasUniqueChannelID(&newchannel, channel)) {
bool uniquityFailed = false;
// Search for identical channels as these will be ignored by vdr
for (cChannel *iteratorChannel = Channels.First(); iteratorChannel;
iteratorChannel = Channels.Next(iteratorChannel)) {
// This is one of the channels cause the uniquity check to fail
if (!iteratorChannel->GroupSep() && iteratorChannel != channel
&& iteratorChannel->GetChannelID() == newchannel.GetChannelID()) {
// See if it has unique Plugin param. If yes then increment
// the corresponding Rid until it is unique
if (strcmp(iteratorChannel->PluginParam(),
newchannel.PluginParam())) {
// If the channel RID is already at maximum, then fail the
// channel modification
if (iteratorChannel->Rid() >= 8192) {
debug("Cannot increment RID over maximum value\n");
uniquityFailed = true;
break;
}
debug("Incrementing conflicting channel RID\n");
iteratorChannel->SetId(iteratorChannel->Nid(),
iteratorChannel->Tid(),
iteratorChannel->Sid(),
iteratorChannel->Rid() + 1);
// Re-set the search and start again
iteratorChannel = Channels.First();
continue;
// Cannot work around by incrementing rid because channels
// are actually copies of each other
} else {
uniquityFailed = true;
break;
}
}
}
if (!uniquityFailed) {
if (channel) { if (channel) {
SetChannelData(channel); SetChannelData(channel);
isyslog("edited channel %d %s", channel->Number(), *channel->ToText()); isyslog("edited channel %d %s", channel->Number(), *channel->ToText());
@ -221,7 +264,7 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key)
Channels.SetModified(true); Channels.SetModified(true);
} }
else { else {
Skins.Message(mtError, trVDR("Channel settings are not unique!")); Skins.Message(mtError, trVDR("Cannot find unique channel settings!"));
state = osContinue; state = osContinue;
} }
} }