2016-02-02 11:04:45 +01:00
|
|
|
/*
|
2020-03-25 05:24:55 +01:00
|
|
|
* Copyright (C) 2015 Julian Scheel <julian@jusst.de>
|
|
|
|
* Copyright (C) 2015 jusst technologies GmbH
|
|
|
|
* Copyright (C) 2015 Digital Devices GmbH
|
2016-02-02 11:04:45 +01:00
|
|
|
*
|
2020-03-25 05:24:55 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
* See LICENSE.md for more information.
|
2016-02-02 11:04:45 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-03-25 05:24:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
#include "client.h"
|
2016-02-02 11:04:45 +01:00
|
|
|
|
2016-09-27 16:05:03 +02:00
|
|
|
#include "p8-platform/threads/threads.h"
|
2020-06-07 16:56:16 +02:00
|
|
|
|
|
|
|
#include <vector>
|
2016-02-02 11:04:45 +01:00
|
|
|
|
2016-03-22 13:17:03 +01:00
|
|
|
struct OctonetEpgEntry
|
|
|
|
{
|
2020-06-07 16:56:16 +02:00
|
|
|
int64_t channelId;
|
|
|
|
time_t start;
|
|
|
|
time_t end;
|
|
|
|
int id;
|
|
|
|
std::string title;
|
|
|
|
std::string subtitle;
|
2016-03-22 13:17:03 +01:00
|
|
|
};
|
|
|
|
|
2016-02-02 11:04:45 +01:00
|
|
|
struct OctonetChannel
|
|
|
|
{
|
2020-06-07 16:56:16 +02:00
|
|
|
int64_t nativeId;
|
|
|
|
std::string name;
|
|
|
|
std::string url;
|
|
|
|
bool radio;
|
|
|
|
int id;
|
2016-03-22 13:17:03 +01:00
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
std::vector<OctonetEpgEntry> epg;
|
2016-02-02 11:04:45 +01:00
|
|
|
};
|
|
|
|
|
2016-02-02 12:18:41 +01:00
|
|
|
struct OctonetGroup
|
|
|
|
{
|
2020-06-07 16:56:16 +02:00
|
|
|
std::string name;
|
|
|
|
bool radio;
|
|
|
|
std::vector<int> members;
|
2016-02-02 12:18:41 +01:00
|
|
|
};
|
|
|
|
|
2016-09-27 16:05:03 +02:00
|
|
|
class OctonetData : public P8PLATFORM::CThread
|
2016-02-02 11:04:45 +01:00
|
|
|
{
|
2020-06-07 16:56:16 +02:00
|
|
|
public:
|
|
|
|
OctonetData(void);
|
|
|
|
virtual ~OctonetData(void);
|
2016-02-02 11:04:45 +01:00
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
virtual int getChannelCount(void);
|
|
|
|
virtual PVR_ERROR getChannels(ADDON_HANDLE handle, bool bRadio);
|
2016-02-02 12:18:41 +01:00
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
virtual int getGroupCount(void);
|
|
|
|
virtual PVR_ERROR getGroups(ADDON_HANDLE handle, bool bRadio);
|
|
|
|
virtual PVR_ERROR getGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP& group);
|
2016-03-22 13:17:03 +01:00
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
virtual PVR_ERROR getEPG(ADDON_HANDLE handle, int iChannelUid, time_t start, time_t end);
|
|
|
|
const std::string& GetUrl(int id) const;
|
|
|
|
const std::string& GetName(int id) const;
|
2016-02-02 11:04:45 +01:00
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
protected:
|
|
|
|
void* Process(void) override;
|
2016-02-02 11:04:45 +01:00
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
bool LoadChannelList(void);
|
|
|
|
bool LoadEPG(void);
|
|
|
|
OctonetGroup* FindGroup(const std::string& name);
|
|
|
|
OctonetChannel* FindChannel(int64_t nativeId);
|
|
|
|
time_t ParseDateTime(std::string date);
|
|
|
|
int64_t ParseID(std::string id);
|
2016-03-22 13:17:03 +01:00
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
private:
|
|
|
|
std::string m_serverAddress;
|
|
|
|
std::vector<OctonetChannel> m_channels;
|
|
|
|
std::vector<OctonetGroup> m_groups;
|
2016-03-22 13:17:03 +01:00
|
|
|
|
2020-06-07 16:56:16 +02:00
|
|
|
time_t m_lastEpgLoad;
|
2016-02-02 11:04:45 +01:00
|
|
|
};
|