From 68fb9608eb6e1f44d770dfd5114f69c57f2b50d0 Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Tue, 22 Mar 2016 13:16:09 +0100 Subject: [PATCH] Generate 64 bit id for internal lookup Store the stringified id from chanellist into a 64 bit integer, which will be used for matching epg data. Signed-off-by: Julian Scheel --- src/OctonetData.cpp | 25 +++++++++++++++---------- src/OctonetData.h | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/OctonetData.cpp b/src/OctonetData.cpp index 805f558..2ef2515 100644 --- a/src/OctonetData.cpp +++ b/src/OctonetData.cpp @@ -46,6 +46,20 @@ OctonetData::~OctonetData(void) groups.clear(); } +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; + + return nativeId; +} + bool OctonetData::loadChannelList() { std::string jsonContent; @@ -80,17 +94,8 @@ bool OctonetData::loadChannelList() chan.name = channel["Title"].asString(); chan.url = "rtsp://" + serverAddress + "/" + channel["Request"].asString(); chan.radio = group.radio; + chan.nativeId = parseID(channel["ID"].asString()); -#if 0 /* Would require a 64 bit identifier */ - std::string id = channel["ID"].asString(); - size_t strip; - /* Strip colons from id */ - while ((strip = id.find(":")) != std::string::npos) - id.erase(strip, 1); - - std::stringstream ids(id); - ids >> chan.id; -#endif chan.id = 1000 + channels.size(); group.members.push_back(channels.size()); channels.push_back(chan); diff --git a/src/OctonetData.h b/src/OctonetData.h index 8bafc4a..1d20717 100644 --- a/src/OctonetData.h +++ b/src/OctonetData.h @@ -30,6 +30,7 @@ struct OctonetChannel { + int64_t nativeId; std::string name; std::string url; bool radio;