--- getservices.1.91 2005-04-28 21:18:06.775213328 +0200 +++ getservices.cpp 2005-04-28 21:49:45.307592536 +0200 @@ -27,6 +27,11 @@ #include #include +// In a final version, the following two lines should be put somewhere else, +// in an include file. +#define MYSERVICES_XML ZAPITCONFIGDIR "/myservices.xml" +#define ANTISERVICES_XML ZAPITCONFIGDIR "/antiservices.xml" + extern transponder_list_t transponders; extern tallchans allchans; @@ -163,6 +168,25 @@ return; } +void NukeChannels(xmlNodePtr search) { + while (search) { + xmlNodePtr transponder = search->xmlChildrenNode; + while ((transponder = xmlGetNextOccurence(transponder, "transponder"))) { + t_transport_stream_id transport_stream_id = xmlGetNumericAttribute(transponder, "id", 16); + t_original_network_id original_network_id = xmlGetNumericAttribute(transponder, "onid", 16); + xmlNodePtr channel = transponder->xmlChildrenNode; + while ((channel = xmlGetNextOccurence(channel, "channel"))) { + t_service_id service_id = xmlGetNumericAttribute(channel, "service_id", 16); + printf("[getservices]: Nuking %d \t%d \t%d \t(%s)\n", service_id, transport_stream_id, original_network_id, xmlGetAttribute(channel, "name")); + allchans.erase(CREATE_CHANNEL_ID); + channel = channel->xmlNextNode; + } + transponder = transponder->xmlNextNode; + } + search = search->xmlNextNode; + } +} + void FindTransponder(xmlNodePtr search) { uint8_t DiSEqC; @@ -276,6 +300,19 @@ FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode); xmlFreeDoc(parser); + + if ((parser = parseXmlFile(MYSERVICES_XML))) { + printf("[getservices] " MYSERVICES_XML " found.\n"); + FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode); + xmlFreeDoc(parser); + } + + if ((parser = parseXmlFile(ANTISERVICES_XML))) { + printf("[getservices] " ANTISERVICES_XML " found.\n"); + NukeChannels(xmlDocGetRootElement(parser)->xmlChildrenNode); + xmlFreeDoc(parser); + } + return 0; }