mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 17:01:08 +02:00
webtv: move loading to bouquets.cpp,
add optional webtvs name= as 'provider' name, and webtv genre= attibutes,
resulting 'provider' created as [name ][genre] with name as WebTV if name absent
Origin commit data
------------------
Branch: ni/coolstream
Commit: 8ea4196d50
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2015-05-12 (Tue, 12 May 2015)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1515,12 +1515,14 @@ void CNeutrinoApp::channelsInit(bool bOnly)
|
||||
AllFavBouquetList->addBouquet(b);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if (!webtvList.empty()) {
|
||||
/* provider */
|
||||
CBouquet* webtvBouquet = new CBouquet(0, g_Locale->getText(LOCALE_BOUQUETNAME_WEBTV), false, true);
|
||||
webtvBouquet->channelList->SetChannelList(&webtvList);
|
||||
TVbouquetList->Bouquets.push_back(webtvBouquet);
|
||||
}
|
||||
#endif
|
||||
printf("[neutrino] got %d TV and %d RADIO bouquets\n", tvi, ri); fflush(stdout);
|
||||
TIMER_STOP("[neutrino] took");
|
||||
|
||||
|
@@ -119,6 +119,7 @@ class CBouquetManager
|
||||
void renumServices();
|
||||
|
||||
CZapitBouquet* addBouquet(const std::string & name, bool ub = false, bool myfav = false, bool to_begin = false);
|
||||
CZapitBouquet* addBouquetIfNotExist(const std::string & name);
|
||||
void deleteBouquet(const unsigned int id);
|
||||
void deleteBouquet(const CZapitBouquet* bouquet);
|
||||
int existsBouquet(char const * const name, bool ignore_user = false);
|
||||
@@ -132,6 +133,7 @@ class CBouquetManager
|
||||
void sortBouquets(void);
|
||||
void setBouquetLock(const unsigned int id, bool state);
|
||||
void setBouquetLock(CZapitBouquet* bouquet, bool state);
|
||||
void loadWebtv();
|
||||
//bouquet writeChannelsNames selection options
|
||||
enum{
|
||||
BWN_NEVER,
|
||||
|
@@ -493,6 +493,7 @@ void CBouquetManager::loadBouquets(bool ignoreBouquetFile)
|
||||
}
|
||||
|
||||
parseBouquetsXml(UBOUQUETS_XML, true);
|
||||
loadWebtv();
|
||||
renumServices();
|
||||
TIMER_STOP("[zapit] bouquet loading took");
|
||||
}
|
||||
@@ -778,6 +779,69 @@ void CBouquetManager::deletePosition(t_satellite_position satellitePosition)
|
||||
Bouquets = tmplist;
|
||||
}
|
||||
|
||||
CZapitBouquet* CBouquetManager::addBouquetIfNotExist(const std::string &name)
|
||||
{
|
||||
CZapitBouquet* bouquet = NULL;
|
||||
|
||||
int bouquetId = existsBouquet(name.c_str(), true);
|
||||
if (bouquetId == -1)
|
||||
bouquet = addBouquet(name, false);
|
||||
else
|
||||
bouquet = Bouquets[bouquetId];
|
||||
|
||||
return bouquet;
|
||||
}
|
||||
|
||||
void CBouquetManager::loadWebtv()
|
||||
{
|
||||
std::list<std::string> *webtv_xml = CZapit::getInstance()->GetWebTVXML();
|
||||
if (!webtv_xml)
|
||||
return;
|
||||
|
||||
for (std::list<std::string>::iterator it = webtv_xml->begin(); it != webtv_xml->end(); ++it) {
|
||||
if (!access((*it).c_str(), R_OK)) {
|
||||
INFO("Loading webtv from %s ...", (*it).c_str());
|
||||
xmlDocPtr parser = parseXmlFile((*it).c_str());
|
||||
if (parser == NULL)
|
||||
continue;
|
||||
|
||||
xmlNodePtr l0 = xmlDocGetRootElement(parser);
|
||||
xmlNodePtr l1 = xmlChildrenNode(l0);
|
||||
if (l1) {
|
||||
CZapitBouquet* pbouquet = NULL;
|
||||
const char *prov = xmlGetAttribute(l0, "name");
|
||||
if (!prov)
|
||||
prov = "WebTV";
|
||||
pbouquet = addBouquetIfNotExist(prov);
|
||||
|
||||
while ((xmlGetNextOccurence(l1, "webtv"))) {
|
||||
const char *title = xmlGetAttribute(l1, "title");
|
||||
const char *url = xmlGetAttribute(l1, "url");
|
||||
const char *desc = xmlGetAttribute(l1, "description");
|
||||
const char *genre = xmlGetAttribute(l1, "genre");
|
||||
|
||||
CZapitBouquet* gbouquet = pbouquet;
|
||||
if (genre) {
|
||||
std::string bname = prov ? std::string(std::string(prov) + " ") + genre : genre;
|
||||
gbouquet = addBouquetIfNotExist(bname);
|
||||
}
|
||||
if (title && url) {
|
||||
t_channel_id chid = create_channel_id64(0, 0, 0, 0, 0, url);
|
||||
CZapitChannel * channel = new CZapitChannel(title, chid, url, desc);
|
||||
CServiceManager::getInstance()->AddChannel(channel);
|
||||
channel->flags = CZapitChannel::UPDATED;
|
||||
if (gbouquet)
|
||||
gbouquet->addService(channel);
|
||||
}
|
||||
|
||||
l1 = xmlNextNode(l1);
|
||||
}
|
||||
}
|
||||
xmlFreeDoc(parser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CBouquetManager::ChannelIterator::ChannelIterator(CBouquetManager* owner, const bool TV)
|
||||
{
|
||||
Owner = owner;
|
||||
|
@@ -867,21 +867,10 @@ bool CServiceManager::LoadServices(bool only_current)
|
||||
xmlDocPtr parser;
|
||||
service_count = 0;
|
||||
printf("[zapit] Loading services, channel size %d ..\n", (int)sizeof(CZapitChannel));
|
||||
//frontendType = CFEManager::getInstance()->getLiveFE()->getInfo()->type;
|
||||
|
||||
std::list<std::string> *webtv_xml = CZapit::getInstance()->GetWebTVXML();
|
||||
|
||||
if(only_current)
|
||||
goto do_current;
|
||||
|
||||
#if 0 // FIXME: obsolete ?
|
||||
static bool satcleared = 0;//clear only once, because menu is static
|
||||
if(!satcleared) {
|
||||
satellitePositions.clear();
|
||||
satcleared = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
TIMER_START();
|
||||
allchans.clear();
|
||||
transponders.clear();
|
||||
@@ -938,41 +927,6 @@ bool CServiceManager::LoadServices(bool only_current)
|
||||
xmlFreeDoc(parser);
|
||||
}
|
||||
|
||||
if (webtv_xml) {
|
||||
for (std::list<std::string>::iterator it = webtv_xml->begin(); it != webtv_xml->end(); ++it) {
|
||||
if (!access((*it).c_str(), R_OK)) {
|
||||
INFO("Loading webtv from %s ...", (*it).c_str());
|
||||
parser = parseXmlFile((*it).c_str());
|
||||
if (parser == NULL)
|
||||
continue;
|
||||
|
||||
xmlNodePtr l0 = xmlDocGetRootElement(parser);
|
||||
xmlNodePtr l1 = xmlChildrenNode(l0);
|
||||
if (l1) {
|
||||
while ((xmlGetNextOccurence(l1, "webtv"))) {
|
||||
const char *title = xmlGetAttribute(l1, "title");
|
||||
const char *url = xmlGetAttribute(l1, "url");
|
||||
const char *desc = xmlGetAttribute(l1, "description");
|
||||
if (title && url) {
|
||||
t_channel_id chid = create_channel_id64(0, 0, 0, 0, 0, url);
|
||||
CZapitChannel * channel = new CZapitChannel(title, chid, url, desc);
|
||||
AddChannel(channel);
|
||||
channel->flags = CZapitChannel::UPDATED;
|
||||
}
|
||||
|
||||
l1 = xmlNextNode(l1);
|
||||
}
|
||||
}
|
||||
xmlFreeDoc(parser);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if (CFEManager::getInstance()->haveSat()) {
|
||||
LoadMotorPositions();
|
||||
}
|
||||
#endif
|
||||
|
||||
LoadProviderMap();
|
||||
printf("[zapit] %d services loaded (%d)...\n", service_count, (int)allchans.size());
|
||||
TIMER_STOP("[zapit] service loading took");
|
||||
|
Reference in New Issue
Block a user