1
0
mirror of https://github.com/DigitalDevices/pvr.octonet.git synced 2023-10-10 13:36:57 +02:00

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 <julian@jusst.de>
This commit is contained in:
Julian Scheel 2016-03-22 13:16:09 +01:00
parent a23e465b63
commit 68fb9608eb
2 changed files with 16 additions and 10 deletions

View File

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

View File

@ -30,6 +30,7 @@
struct OctonetChannel
{
int64_t nativeId;
std::string name;
std::string url;
bool radio;