Modified channels.conf parameters to be caseinsensitive.

This commit is contained in:
Rolf Ahrenberg 2007-10-20 20:35:06 +00:00
parent cf6195bb8a
commit 3c30852c81
2 changed files with 48 additions and 42 deletions

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: device.c,v 1.71 2007/10/19 22:18:55 rahrenbe Exp $ * $Id: device.c,v 1.72 2007/10/20 20:35:06 rahrenbe Exp $
*/ */
#include "config.h" #include "config.h"
@ -158,26 +158,29 @@ cString cIptvDevice::GetInformation(unsigned int Page)
cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, cIptvProtocolIf* *Protocol) cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, cIptvProtocolIf* *Protocol)
{ {
debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex); debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex);
char *tag = NULL;
char *proto = NULL;
char *loc = NULL; char *loc = NULL;
if (sscanf(IptvParam, "IPTV|UDP|%a[^|]|%u", &loc, Parameter) == 2) { if (sscanf(IptvParam, "%a[^|]|%a[^|]|%a[^|]|%u", &tag, &proto, &loc, Parameter) == 4) {
cString addr(loc, true); cString tagstr(tag, true);
*Protocol = pUdpProtocol; cString protostr(proto, true);
return addr; cString locstr(loc, true);
} // check if IPTV tag
else if (sscanf(IptvParam, "IPTV|HTTP|%a[^|]|%u", &loc, Parameter) == 2) { if (strncasecmp(*tagstr, "IPTV", 4) == 0) {
cString addr(loc, true); // check if protocol is supported and update the pointer
*Protocol = pHttpProtocol; if (strncasecmp(*protostr, "UDP", 3) == 0)
return addr; *Protocol = pUdpProtocol;
} else if (strncasecmp(*protostr, "HTTP", 4) == 0)
else if (sscanf(IptvParam, "IPTV|FILE|%a[^|]|%u", &loc, Parameter) == 2) { *Protocol = pHttpProtocol;
cString addr(loc, true); else if (strncasecmp(*protostr, "FILE", 4) == 0)
*Protocol = pFileProtocol; *Protocol = pFileProtocol;
return addr; else if (strncasecmp(*protostr, "EXT", 3) == 0)
} *Protocol = pExtProtocol;
else if (sscanf(IptvParam, "IPTV|EXT|%a[^|]|%u", &loc, Parameter) == 2) { else
cString addr(loc, true); return NULL;
*Protocol = pExtProtocol; // return location
return addr; return locstr;
}
} }
return NULL; return NULL;
} }
@ -185,7 +188,7 @@ cString cIptvDevice::GetChannelSettings(const char *IptvParam, int *Parameter, c
bool cIptvDevice::ProvidesIptv(const char *Param) const bool cIptvDevice::ProvidesIptv(const char *Param) const
{ {
debug("cIptvDevice::ProvidesIptv(%d)\n", deviceIndex); debug("cIptvDevice::ProvidesIptv(%d)\n", deviceIndex);
return (strncmp(Param, "IPTV", 4) == 0); return (strncasecmp(Param, "IPTV", 4) == 0);
} }
bool cIptvDevice::ProvidesSource(int Source) const bool cIptvDevice::ProvidesSource(int Source) const

45
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.40 2007/10/20 17:26:46 rahrenbe Exp $ * $Id: setup.c,v 1.41 2007/10/20 20:35:06 rahrenbe Exp $
*/ */
#include <string.h> #include <string.h>
@ -70,26 +70,29 @@ cIptvMenuEditChannel::cIptvMenuEditChannel(cChannel *Channel, bool New)
cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter, int *Protocol) cString cIptvMenuEditChannel::GetIptvSettings(const char *Param, int *Parameter, int *Protocol)
{ {
char *tag = NULL;
char *proto = NULL;
char *loc = NULL; char *loc = NULL;
if (sscanf(Param, "IPTV|UDP|%a[^|]|%u", &loc, Parameter) == 2) { if (sscanf(Param, "%a[^|]|%a[^|]|%a[^|]|%u", &tag, &proto, &loc, Parameter) == 4) {
cString addr(loc, true); cString tagstr(tag, true);
*Protocol = eProtocolUDP; cString protostr(proto, true);
return addr; cString locstr(loc, true);
} // check if IPTV tag
else if (sscanf(Param, "IPTV|HTTP|%a[^|]|%u", &loc, Parameter) == 2) { if (strncasecmp(*tagstr, "IPTV", 4) == 0) {
cString addr(loc, true); // check if protocol is supported and update the pointer
*Protocol = eProtocolHTTP; if (strncasecmp(*protostr, "UDP", 3) == 0)
return addr; *Protocol = eProtocolUDP;
} else if (strncasecmp(*protostr, "HTTP", 4) == 0)
else if (sscanf(Param, "IPTV|FILE|%a[^|]|%u", &loc, Parameter) == 2) { *Protocol = eProtocolHTTP;
cString addr(loc, true); else if (strncasecmp(*protostr, "FILE", 4) == 0)
*Protocol = eProtocolFILE; *Protocol = eProtocolFILE;
return addr; else if (strncasecmp(*protostr, "EXT", 3) == 0)
} *Protocol = eProtocolEXT;
else if (sscanf(Param, "IPTV|EXT|%a[^|]|%u", &loc, Parameter) == 2) { else
cString addr(loc, true); return NULL;
*Protocol = eProtocolEXT; // return location
return addr; return locstr;
}
} }
return NULL; return NULL;
} }
@ -379,7 +382,7 @@ void cIptvMenuChannels::Setup(void)
{ {
Clear(); Clear();
for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) { for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) {
if (!channel->GroupSep() && channel->IsPlug() && !strncmp(channel->PluginParam(), "IPTV", 4)) { if (!channel->GroupSep() && channel->IsPlug() && !strncasecmp(channel->PluginParam(), "IPTV", 4)) {
cIptvMenuChannelItem *item = new cIptvMenuChannelItem(channel); cIptvMenuChannelItem *item = new cIptvMenuChannelItem(channel);
Add(item); Add(item);
} }