// load transponders int loadTransponders() { bool satcleared = 0; scnt = 0; t_satellite_position position = 0; //first postion dprintf(DEBUG_NORMAL, "getServices:loadTransponders:\n"); select_transponders.clear(); fake_tid = fake_nid = 0; if(!satcleared) satellitePositions.clear(); satcleared = 1; fe_type_t fe_type = FE_QAM; // parse sat tp for(int i = 0; i < FrontendCount; i++) { CFrontend * fe = getFE(i); fe_type = fe->getInfo()->type; //parseScanInputXml(i); parseScanInputXml(fe_type); if ( scanInputParser != NULL ) { xmlNodePtr search = xmlDocGetRootElement(scanInputParser)->xmlChildrenNode; while (search) { if (!(strcmp(xmlGetName(search), "sat"))) { // position position = xmlGetSignedNumericAttribute(search, "position", 10); char * name = xmlGetAttribute(search, "name"); if(satellitePositions.find(position) == satellitePositions.end()) { init_sat(position); } // name satellitePositions[position].name = name; // type satellitePositions[position].type = DVB_S; } else if(!(strcmp(xmlGetName(search), "cable"))) { //flags ??? //satfeed ??? char * name = xmlGetAttribute(search, "name"); if(satellitePositions.find(position) == satellitePositions.end()) { init_sat(position); } // name satellitePositions[position].name = name; // type //needed to resort list for scan menue satellitePositions[position].type = DVB_C; } else if(!(strcmp(xmlGetName(search), "terrestrial"))) { char * name = xmlGetAttribute(search, "name"); if(satellitePositions.find(position) == satellitePositions.end()) { init_sat(position); } // name satellitePositions[position].name = name; // type //needed to resort list for scan menue satellitePositions[position].type = DVB_T; } // parse sat TP ParseSatTransponders(fe_type, search, position); position++; search = search->xmlNextNode; } } } // satip if(g_settings.satip_allow_satip) { if(g_settings.satip_serverbox_type == DVB_C) fe_type = FE_QAM; else if(g_settings.satip_serverbox_type == DVB_S) fe_type = FE_QPSK; else if(g_settings.satip_serverbox_type == DVB_T) fe_type = FE_OFDM; parseScanInputXml(fe_type); if ( scanInputParser != NULL ) { xmlNodePtr search = xmlDocGetRootElement(scanInputParser)->xmlChildrenNode; while (search) { if (!(strcmp(xmlGetName(search), "sat"))) { // position position = xmlGetSignedNumericAttribute(search, "position", 10); char * name = xmlGetAttribute(search, "name"); if(satellitePositions.find(position) == satellitePositions.end()) { init_sat(position); } // name satellitePositions[position].name = name; // type satellitePositions[position].type = DVB_S; } else if(!(strcmp(xmlGetName(search), "cable"))) { //flags ??? //satfeed ??? char * name = xmlGetAttribute(search, "name"); if(satellitePositions.find(position) == satellitePositions.end()) { init_sat(position); } // name satellitePositions[position].name = name; // type //needed to resort list for scan menue satellitePositions[position].type = DVB_C; } else if(!(strcmp(xmlGetName(search), "terrestrial"))) { char * name = xmlGetAttribute(search, "name"); if(satellitePositions.find(position) == satellitePositions.end()) { init_sat(position); } // name satellitePositions[position].name = name; // type //needed to resort list for scan menue satellitePositions[position].type = DVB_T; } // parse sat TP ParseSatTransponders(fe_type, search, position); position++; search = search->xmlNextNode; } } } return 0; }
bool CServiceManager::LoadServices(bool only_current) { xmlDocPtr parser; static bool satcleared = 0;//clear only once, because menu is static service_count = 0; printf("[zapit] Loading services, channel size %d ..\n", sizeof(CZapitChannel)); fe_type_t frontendType = CFrontend::getInstance()->getInfo()->type; if(only_current) goto do_current; TIMER_START(); allchans.clear(); transponders.clear(); select_transponders.clear(); fake_tid = fake_nid = 0; if (ParseScanXml()) { t_satellite_position position = 0; if(!satcleared) satellitePositions.clear(); satcleared = 1; xmlNodePtr search = xmlDocGetRootElement(scanInputParser)->xmlChildrenNode; while (search) { if (!(strcmp(xmlGetName(search), "sat"))) { position = xmlGetSignedNumericAttribute(search, "position", 10); char * name = xmlGetAttribute(search, "name"); /* FIXME reuse this */ if(satellitePositions.find(position) == satellitePositions.end()) { InitSatPosition(position); } satellitePositions[position].name = name; } else if(!(strcmp(xmlGetName(search), "cable"))) { char * name = xmlGetAttribute(search, "name"); if(satellitePositions.find(position) == satellitePositions.end()) { InitSatPosition(position); } satellitePositions[position].name = name; } ParseSatTransponders(frontendType, search, position); position++; search = search->xmlNextNode; } } parser = parseXmlFile(SERVICES_XML); if (parser != NULL) { xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode; while (search) { if (!(strcmp(xmlGetName(search), "sat"))) { t_satellite_position position = xmlGetSignedNumericAttribute(search, "position", 10); char * name = xmlGetAttribute(search, "name"); if(satellitePositions.find(position) == satellitePositions.end()) { InitSatPosition(position); satellitePositions[position].name = name; } } search = search->xmlNextNode; } FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode); xmlFreeDoc(parser); } if(frontendType == FE_QPSK) { LoadMotorPositions(); } printf("[zapit] %d services loaded (%d)...\n", service_count, allchans.size()); TIMER_STOP("[zapit] service loading took"); if(0) { //zapit_debug) {//FIXME sat_iterator_t sit; for(sit = satellitePositions.begin(); sit != satellitePositions.end(); sit++) printf("satelliteName = %s (%d), satellitePosition = %d motor position = %d usals %d\n", sit->second.name.c_str(), sit->second.name.size(), sit->first, sit->second.motor_position, sit->second.use_usals); } do_current: DBG("Loading current..\n"); if (CZapit::getInstance()->scanSDT() && (parser = parseXmlFile(CURRENTSERVICES_XML))) { newfound = 0; printf("[getservices] " CURRENTSERVICES_XML " found.\n"); FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode); xmlFreeDoc(parser); unlink(CURRENTSERVICES_XML); if(newfound) SaveServices(true); } if(!only_current) { parser = parseXmlFile(MYSERVICES_XML); if (parser != NULL) { FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode); xmlFreeDoc(parser); } } return true; }