From 1cdf16c4ebc99c77a7829556cd0dda3d11441dbb Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 29 Jan 2013 21:01:35 +0100 Subject: [PATCH] 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) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4c298ed2d3bc1f042f434a078849567735427197 Author: Stefan Seyfried Date: 2013-01-29 (Tue, 29 Jan 2013) --- src/zapit/include/zapit/getservices.h | 2 ++ src/zapit/src/getservices.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index 10d6deef0..fa2e5d33a 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 85a0c649d..b2ea9cf03 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -3,7 +3,7 @@ * * (C) 2002, 2003 by Andreas Oberritter * - * (C) 2007-2012 Stefan Seyfried + * (C) 2007-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 @@ -223,6 +223,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();