X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb%2Fdb.cpp;h=ae30e3604507a72df50b20b8aeeda9770dbdb2a1;hp=e4d9ad228e6d8139ca3911e4fa9bf075a4329459;hb=e21cff679bb73bce310e877d5219ec29291dbe10;hpb=bce53d4a67d1655a496eebe5912c8573e880114e diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index e4d9ad2..ae30e36 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -265,6 +265,42 @@ void eDVBDB::reloadServicelist() loadServicelist(CONFIGDIR"/enigma2/lamedb"); } +void eDVBDB::parseServiceData(ePtr s, std::string str) +{ + while ((!str.empty()) && str[1]==':') // new: p:, f:, c:%02d... + { + size_t c=str.find(','); + char p=str[0]; + std::string v; + if (c == std::string::npos) + { + v=str.substr(2); + str=""; + } else + { + v=str.substr(2, c-2); + str=str.substr(c+1); + } +// eDebug("%c ... %s", p, v.c_str()); + if (p == 'p') + s->m_provider_name=v; + else if (p == 'f') + { + sscanf(v.c_str(), "%x", &s->m_flags); + } else if (p == 'c') + { + int cid, val; + sscanf(v.c_str(), "%02d%x", &cid, &val); + s->setCacheEntry((eDVBService::cacheID)cid,val); + } else if (p == 'C') + { + int val; + sscanf(v.c_str(), "%04x", &val); + s->m_ca.push_front((uint16_t)val); + } + } +} + /* THIS CODE IS BAD. it should be replaced by somethine better. */ void eDVBDB::loadServicelist(const char *file) { @@ -425,44 +461,10 @@ void eDVBDB::loadServicelist(const char *file) fgets(line, 256, f); if (strlen(line)) line[strlen(line)-1]=0; - std::string str=line; - - if (str[1]!=':') // old ... (only service_provider) - { + if (line[1]!=':') // old ... (only service_provider) s->m_provider_name=line; - } else - while ((!str.empty()) && str[1]==':') // new: p:, f:, c:%02d... - { - size_t c=str.find(','); - char p=str[0]; - std::string v; - if (c == std::string::npos) - { - v=str.substr(2); - str=""; - } else - { - v=str.substr(2, c-2); - str=str.substr(c+1); - } -// eDebug("%c ... %s", p, v.c_str()); - if (p == 'p') - s->m_provider_name=v; - else if (p == 'f') - { - sscanf(v.c_str(), "%x", &s->m_flags); - } else if (p == 'c') - { - int cid, val; - sscanf(v.c_str(), "%02d%x", &cid, &val); - s->setCacheEntry((eDVBService::cacheID)cid,val); - } else if (p == 'C') - { - int val; - sscanf(v.c_str(), "%04x", &val); - s->m_ca.push_front((uint16_t)val); - } - } + else + parseServiceData(s, line); addService(ref, s); } @@ -1374,7 +1376,7 @@ RESULT eDVBDB::addChannelToList(const eDVBChannelID &id, iDVBFrontendParameters { channel ch; std::map::iterator it = m_channels.find(id); - assert(feparm); + ASSERT(feparm); ch.m_frontendParameters = feparm; if (it != m_channels.end()) it->second = ch;