zapit/bouquets: format changes

Origin commit data
------------------
Commit: 2179bc92d2
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-08-23 (Thu, 23 Aug 2018)

Origin message was:
------------------
- zapit/bouquets: format changes
This commit is contained in:
vanhofen
2018-08-23 22:29:17 +02:00
parent 3a80a7a7c8
commit 9c03b7fba8

View File

@@ -859,74 +859,73 @@ void CBouquetManager::loadWebchannels(int mode)
if (xml) if (xml)
{ {
xmlDocPtr parser = parseXmlFile((*it).c_str()); xmlDocPtr parser = parseXmlFile((*it).c_str());
if (parser == NULL) if (parser == NULL)
continue; continue;
xmlNodePtr l0 = xmlDocGetRootElement(parser); xmlNodePtr l0 = xmlDocGetRootElement(parser);
xmlNodePtr l1 = xmlChildrenNode(l0); xmlNodePtr l1 = xmlChildrenNode(l0);
if (l1) if (l1)
{ {
CZapitBouquet* pbouquet = NULL; CZapitBouquet* pbouquet = NULL;
const char *prov = xmlGetAttribute(l0, "name"); const char *prov = xmlGetAttribute(l0, "name");
if (!prov) if (!prov)
prov = (mode == MODE_WEBTV) ? "WebTV" : "WebRadio"; prov = (mode == MODE_WEBTV) ? "WebTV" : "WebRadio";
pbouquet = addBouquetIfNotExist(prov); pbouquet = addBouquetIfNotExist(prov);
if (mode == MODE_WEBTV) if (mode == MODE_WEBTV)
pbouquet->bWebtv = true; pbouquet->bWebtv = true;
else else
pbouquet->bWebradio = true; pbouquet->bWebradio = true;
while ((xmlGetNextOccurence(l1, (mode == MODE_WEBTV) ? "webtv" : "webradio"))) while ((xmlGetNextOccurence(l1, (mode == MODE_WEBTV) ? "webtv" : "webradio")))
{ {
const char *title = xmlGetAttribute(l1, "title"); const char *title = xmlGetAttribute(l1, "title");
const char *url = xmlGetAttribute(l1, "url"); const char *url = xmlGetAttribute(l1, "url");
const char *desc = xmlGetAttribute(l1, "description"); const char *desc = xmlGetAttribute(l1, "description");
const char *genre = xmlGetAttribute(l1, "genre"); const char *genre = xmlGetAttribute(l1, "genre");
const char *epgid = xmlGetAttribute(l1, "epgid"); const char *epgid = xmlGetAttribute(l1, "epgid");
const char *script = xmlGetAttribute(l1, "script"); const char *script = xmlGetAttribute(l1, "script");
t_channel_id epg_id = 0; t_channel_id epg_id = 0;
if (epgid) if (epgid)
{
//NI
if (strcmp(epgid, "auto") == 0 && title)
{ {
CZapitChannel * channel = CServiceManager::getInstance()->FindChannelByPattern(title); if (strcmp(epgid, "auto") == 0 && title)
if (channel && !IS_WEBCHAN(channel->getChannelID()))
{ {
epg_id = channel->getChannelID(); CZapitChannel * channel = CServiceManager::getInstance()->FindChannelByPattern(title);
INFO("* auto epg_id found for %s: " PRINTF_CHANNEL_ID_TYPE "", title, epg_id); if (channel && !IS_WEBCHAN(channel->getChannelID()))
{
epg_id = channel->getChannelID();
INFO("* auto epg_id found for %s: " PRINTF_CHANNEL_ID_TYPE "\n", title, epg_id);
}
} }
else
epg_id = strtoull(epgid, NULL, 16);
} }
else
epg_id = strtoull(epgid, NULL, 16);
}
CZapitBouquet* gbouquet = pbouquet; CZapitBouquet* gbouquet = pbouquet;
if (genre) if (genre)
{ {
std::string bname = prov ? std::string(std::string(prov) + " ") + genre : genre; std::string bname = prov ? std::string(std::string(prov) + " ") + genre : genre;
gbouquet = addBouquetIfNotExist(bname); gbouquet = addBouquetIfNotExist(bname);
if (mode == MODE_WEBTV) if (mode == MODE_WEBTV)
gbouquet->bWebtv = true; gbouquet->bWebtv = true;
else else
gbouquet->bWebradio = true; gbouquet->bWebradio = true;
} }
if (title && url) if (title && url)
{ {
t_channel_id chid = create_channel_id64(0, 0, 0, 0, 0, url); t_channel_id chid = create_channel_id64(0, 0, 0, 0, 0, url);
CZapitChannel * channel = new CZapitChannel(title, chid, url, desc, epg_id, script, mode); CZapitChannel * channel = new CZapitChannel(title, chid, url, desc, epg_id, script, mode);
CServiceManager::getInstance()->AddChannel(channel); CServiceManager::getInstance()->AddChannel(channel);
channel->flags = CZapitChannel::UPDATED; channel->flags = CZapitChannel::UPDATED;
if (gbouquet) if (gbouquet)
gbouquet->addService(channel); gbouquet->addService(channel);
} }
l1 = xmlNextNode(l1); l1 = xmlNextNode(l1);
}
} }
xmlFreeDoc(parser);
} }
xmlFreeDoc(parser);
}
else if(m3u) else if(m3u)
{ {
std::ifstream infile; std::ifstream infile;
@@ -965,8 +964,9 @@ void CBouquetManager::loadWebchannels(int mode)
if (iColon >= 0 && iComma >= 0 && iComma > iColon) if (iColon >= 0 && iComma >= 0 && iComma > iColon)
{ {
iComma++; iComma++;
iColon++;
title = strLine.substr(iComma); title = strLine.substr(iComma);
std::string strInfoLine = strLine.substr(++iColon, --iComma - iColon); std::string strInfoLine = strLine.substr(iColon, --iComma - iColon);
desc = ReadMarkerValue(strInfoLine, TVG_INFO_NAME_MARKER); desc = ReadMarkerValue(strInfoLine, TVG_INFO_NAME_MARKER);
group = ReadMarkerValue(strInfoLine, GROUP_NAME_MARKER); group = ReadMarkerValue(strInfoLine, GROUP_NAME_MARKER);
epgid = ReadMarkerValue(strInfoLine, TVG_INFO_ID_MARKER); epgid = ReadMarkerValue(strInfoLine, TVG_INFO_ID_MARKER);
@@ -979,7 +979,6 @@ void CBouquetManager::loadWebchannels(int mode)
pbouquet->bWebradio = true; pbouquet->bWebradio = true;
} }
else if (strLine[0] != '#') else if (strLine[0] != '#')
{ {
char *url = NULL; char *url = NULL;
@@ -1077,11 +1076,9 @@ void CBouquetManager::loadWebchannels(int mode)
} }
} }
fclose(f); fclose(f);
} }
} }
} }
} }
} }
@@ -1187,7 +1184,8 @@ void CBouquetManager::readEPGMapping()
if(epgmap) if(epgmap)
epgmap = xmlChildrenNode(epgmap); epgmap = xmlChildrenNode(epgmap);
while (epgmap) { while (epgmap)
{
const char *cannelid = xmlGetAttribute(epgmap, "channel_id"); const char *cannelid = xmlGetAttribute(epgmap, "channel_id");
const char *epgid = xmlGetAttribute(epgmap, "new_epg_id"); const char *epgid = xmlGetAttribute(epgmap, "new_epg_id");
t_channel_id epg_id = 0; t_channel_id epg_id = 0;