OctonetData: Use hash for channel nativeId

We previously assumed that the channelId provided by the Octonet would
only contain numbers and colons, which unfortunately is not true. The
satellite names could contain arbitrary characters, which then caused
the conversion to a numeric value to fail, stopping channels from being
distinguishable. This caused all EPG events to be mapped to the first
channel.

Signed-off-by: Julian Scheel <julian@jusst.de>
This commit is contained in:
Julian Scheel 2017-07-06 14:21:41 +02:00
parent d7bb865329
commit 020dd98e7b
1 changed files with 2 additions and 8 deletions

View File

@ -53,14 +53,8 @@ OctonetData::~OctonetData(void)
int64_t OctonetData::parseID(std::string id)
{
int64_t nativeId;
size_t strip;
/* Strip colons from id */
while ((strip = id.find(":")) != std::string::npos)
id.erase(strip, 1);
std::stringstream ids(id);
ids >> nativeId;
std::hash<std::string> hash_fn;
int64_t nativeId = hash_fn(id);
return nativeId;
}