From 536484f698ea94e4049abd31945ff8854fa5cb84 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 29 Jan 2013 21:01:35 +0100 Subject: [PATCH 1/2] getservices: add FindChannelFuzzy() function Add a function that returns a channel if tsid, onid, sid and satellite position matches and the frequency matches +-2MHz. (This frequency tolerance allows ubouquets to be used after updates to satellites.xml) --- src/zapit/include/zapit/getservices.h | 2 ++ src/zapit/src/getservices.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index 7783bcfbb..0233b9016 100644 --- a/src/zapit/include/zapit/getservices.h +++ b/src/zapit/include/zapit/getservices.h @@ -128,6 +128,8 @@ class CServiceManager CZapitChannel* FindChannelByName(std::string name); CZapitChannel* FindCurrentChannel(const t_channel_id channel_id); CZapitChannel* FindChannel48(const t_channel_id channel_id); + CZapitChannel* FindChannelFuzzy(const t_channel_id channel_id, + const t_satellite_position pos, const freq_id_t freq); std::string GetServiceName(t_channel_id channel_id); diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 0aa479238..693da3522 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -3,6 +3,8 @@ * * (C) 2002, 2003 by Andreas Oberritter * + * (C) 2007-2009, 2013 Stefan Seyfried + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -220,6 +222,18 @@ CZapitChannel * CServiceManager::FindChannel48(const t_channel_id channel_id) return NULL; } +CZapitChannel* CServiceManager::FindChannelFuzzy(const t_channel_id channel_id, + const t_satellite_position pos, const freq_id_t freq) +{ + CZapitChannel *ret; + ret = FindChannel48(channel_id); + if (!ret || !(pos == ret->getSatellitePosition())) + return NULL; + if (abs((int)ret->getFreqId() - (int)freq) < 3) + return ret; + return NULL; +} + bool CServiceManager::GetAllRadioChannels(ZapitChannelList &list, int flags) { list.clear(); From 70b3ef04f92d7f6f2d65ed7eab934beefcbe0af0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 29 Jan 2013 21:05:53 +0100 Subject: [PATCH 2/2] bouquets: fix ubouquet generation for broken services Services with duplicate tsid/onid/sid like found e.g. on "8W Atlantic Bird 2", "12.5W Atlantic Bird 1", "4.8E Sirius", "7E Eutelsat" caused wrong bouquet entries because the satellite position and transponder frequency was not used to distinguish the channels. Use the new FindChannelFuzzy() function to fix this. --- src/zapit/src/bouquets.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 8a74c0a8f..f6f40259d 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -7,6 +7,8 @@ * rasc , * thegoodguy * + * (C) 2009, 2011, 2013 Stefan Seyfried + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -363,10 +365,11 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser) freq = freq/1000; CZapitChannel* chan; + t_channel_id chid = CREATE_CHANNEL_ID64; if(bUser) - chan = CServiceManager::getInstance()->FindChannel48(CREATE_CHANNEL_ID64); + chan = CServiceManager::getInstance()->FindChannelFuzzy(chid, satellitePosition, freq); else - chan = CServiceManager::getInstance()->FindChannel(CREATE_CHANNEL_ID64); + chan = CServiceManager::getInstance()->FindChannel(chid); if (chan != NULL) { DBG("%04x %04x %04x %s\n", transport_stream_id, original_network_id, service_id, xmlGetAttribute(channel_node, "n")); #if 0