From 9c03b7fba87f18f32e953969bcdf64a9dffcdff2 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 23 Aug 2018 22:29:17 +0200 Subject: [PATCH] zapit/bouquets: format changes Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2179bc92d205ec08f3d13fc83155affc467435d0 Author: vanhofen Date: 2018-08-23 (Thu, 23 Aug 2018) Origin message was: ------------------ - zapit/bouquets: format changes --- src/zapit/src/bouquets.cpp | 108 ++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 556e158a3..49845f74b 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -859,74 +859,73 @@ void CBouquetManager::loadWebchannels(int mode) if (xml) { - xmlDocPtr parser = parseXmlFile((*it).c_str()); - if (parser == NULL) - continue; + xmlDocPtr parser = parseXmlFile((*it).c_str()); + if (parser == NULL) + continue; - xmlNodePtr l0 = xmlDocGetRootElement(parser); - xmlNodePtr l1 = xmlChildrenNode(l0); + xmlNodePtr l0 = xmlDocGetRootElement(parser); + xmlNodePtr l1 = xmlChildrenNode(l0); if (l1) { - CZapitBouquet* pbouquet = NULL; - const char *prov = xmlGetAttribute(l0, "name"); - if (!prov) - prov = (mode == MODE_WEBTV) ? "WebTV" : "WebRadio"; - pbouquet = addBouquetIfNotExist(prov); - if (mode == MODE_WEBTV) - pbouquet->bWebtv = true; - else - pbouquet->bWebradio = true; + CZapitBouquet* pbouquet = NULL; + const char *prov = xmlGetAttribute(l0, "name"); + if (!prov) + prov = (mode == MODE_WEBTV) ? "WebTV" : "WebRadio"; + pbouquet = addBouquetIfNotExist(prov); + if (mode == MODE_WEBTV) + pbouquet->bWebtv = true; + else + pbouquet->bWebradio = true; while ((xmlGetNextOccurence(l1, (mode == MODE_WEBTV) ? "webtv" : "webradio"))) { - const char *title = xmlGetAttribute(l1, "title"); - const char *url = xmlGetAttribute(l1, "url"); - const char *desc = xmlGetAttribute(l1, "description"); - const char *genre = xmlGetAttribute(l1, "genre"); - const char *epgid = xmlGetAttribute(l1, "epgid"); - const char *script = xmlGetAttribute(l1, "script"); - t_channel_id epg_id = 0; - if (epgid) - { - //NI - if (strcmp(epgid, "auto") == 0 && title) + const char *title = xmlGetAttribute(l1, "title"); + const char *url = xmlGetAttribute(l1, "url"); + const char *desc = xmlGetAttribute(l1, "description"); + const char *genre = xmlGetAttribute(l1, "genre"); + const char *epgid = xmlGetAttribute(l1, "epgid"); + const char *script = xmlGetAttribute(l1, "script"); + t_channel_id epg_id = 0; + if (epgid) { - CZapitChannel * channel = CServiceManager::getInstance()->FindChannelByPattern(title); - if (channel && !IS_WEBCHAN(channel->getChannelID())) + if (strcmp(epgid, "auto") == 0 && title) { - epg_id = channel->getChannelID(); - INFO("* auto epg_id found for %s: " PRINTF_CHANNEL_ID_TYPE "", title, epg_id); + CZapitChannel * channel = CServiceManager::getInstance()->FindChannelByPattern(title); + 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) { - std::string bname = prov ? std::string(std::string(prov) + " ") + genre : genre; - gbouquet = addBouquetIfNotExist(bname); - if (mode == MODE_WEBTV) - gbouquet->bWebtv = true; - else - gbouquet->bWebradio = true; - } + std::string bname = prov ? std::string(std::string(prov) + " ") + genre : genre; + gbouquet = addBouquetIfNotExist(bname); + if (mode == MODE_WEBTV) + gbouquet->bWebtv = true; + else + gbouquet->bWebradio = true; + } if (title && 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); - CServiceManager::getInstance()->AddChannel(channel); - channel->flags = CZapitChannel::UPDATED; - if (gbouquet) - gbouquet->addService(channel); - } + 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); + CServiceManager::getInstance()->AddChannel(channel); + channel->flags = CZapitChannel::UPDATED; + if (gbouquet) + gbouquet->addService(channel); + } - l1 = xmlNextNode(l1); + l1 = xmlNextNode(l1); + } } + xmlFreeDoc(parser); } - xmlFreeDoc(parser); - } else if(m3u) { std::ifstream infile; @@ -965,8 +964,9 @@ void CBouquetManager::loadWebchannels(int mode) if (iColon >= 0 && iComma >= 0 && iComma > iColon) { iComma++; + iColon++; 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); group = ReadMarkerValue(strInfoLine, GROUP_NAME_MARKER); epgid = ReadMarkerValue(strInfoLine, TVG_INFO_ID_MARKER); @@ -979,7 +979,6 @@ void CBouquetManager::loadWebchannels(int mode) pbouquet->bWebradio = true; } - else if (strLine[0] != '#') { char *url = NULL; @@ -1077,11 +1076,9 @@ void CBouquetManager::loadWebchannels(int mode) } } - fclose(f); } } - } } } @@ -1187,7 +1184,8 @@ void CBouquetManager::readEPGMapping() if(epgmap) epgmap = xmlChildrenNode(epgmap); - while (epgmap) { + while (epgmap) + { const char *cannelid = xmlGetAttribute(epgmap, "channel_id"); const char *epgid = xmlGetAttribute(epgmap, "new_epg_id"); t_channel_id epg_id = 0;