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();