From 567232b5fb7a5ad512779945c5846493c4264098 Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Tue, 28 Dec 2021 13:27:10 +0100 Subject: [PATCH 1/2] API related update --- src/OctonetData.cpp | 7 +++---- src/OctonetData.h | 5 ++--- src/addon.cpp | 28 ++++++++++++---------------- src/addon.h | 16 ++++++---------- 4 files changed, 23 insertions(+), 33 deletions(-) diff --git a/src/OctonetData.cpp b/src/OctonetData.cpp index 47434a8..2bd242c 100644 --- a/src/OctonetData.cpp +++ b/src/OctonetData.cpp @@ -23,9 +23,8 @@ #endif OctonetData::OctonetData(const std::string& octonetAddress, - KODI_HANDLE instance, - const std::string& kodiVersion) - : kodi::addon::CInstancePVRClient(instance, kodiVersion) + const kodi::addon::IInstanceInfo& instance) + : kodi::addon::CInstancePVRClient(instance) { m_serverAddress = octonetAddress; m_channels.clear(); @@ -33,7 +32,7 @@ OctonetData::OctonetData(const std::string& octonetAddress, m_lastEpgLoad = 0; if (!LoadChannelList()) - kodi::QueueFormattedNotification(QUEUE_ERROR, kodi::GetLocalizedString(30001).c_str(), + kodi::QueueFormattedNotification(QUEUE_ERROR, kodi::addon::GetLocalizedString(30001).c_str(), m_channels.size()); /* diff --git a/src/OctonetData.h b/src/OctonetData.h index 909f392..f67931f 100644 --- a/src/OctonetData.h +++ b/src/OctonetData.h @@ -43,12 +43,11 @@ struct OctonetGroup std::vector members; }; -class ATTRIBUTE_HIDDEN OctonetData : public kodi::addon::CInstancePVRClient +class ATTR_DLL_LOCAL OctonetData : public kodi::addon::CInstancePVRClient { public: OctonetData(const std::string& octonetAddress, - KODI_HANDLE instance, - const std::string& kodiVersion); + const kodi::addon::IInstanceInfo& instance); ~OctonetData() override; PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities& capabilities) override; diff --git a/src/addon.cpp b/src/addon.cpp index efd9afa..3a22537 100644 --- a/src/addon.cpp +++ b/src/addon.cpp @@ -13,45 +13,41 @@ #include "OctonetData.h" ADDON_STATUS COctonetAddon::SetSetting(const std::string& settingName, - const kodi::CSettingValue& settingValue) + const kodi::addon::CSettingValue& settingValue) { /* For simplicity do a full addon restart whenever settings are * changed */ return ADDON_STATUS_NEED_RESTART; } -ADDON_STATUS COctonetAddon::CreateInstance(int instanceType, - const std::string& instanceID, - KODI_HANDLE instance, - const std::string& version, - KODI_HANDLE& addonInstance) +ADDON_STATUS COctonetAddon::CreateInstance(const kodi::addon::IInstanceInfo& instance, + KODI_ADDON_INSTANCE_HDL& hdl) { - if (instanceType == ADDON_INSTANCE_PVR) + if (instance.IsType(ADDON_INSTANCE_PVR)) { kodi::Log(ADDON_LOG_DEBUG, "%s: Creating octonet pvr instance", __func__); /* IP or hostname of the octonet to be connected to */ - std::string octonetAddress = kodi::GetSettingString("octonetAddress"); + std::string octonetAddress = kodi::addon::GetSettingString("octonetAddress"); - OctonetData* usedInstance = new OctonetData(octonetAddress, instance, version); - addonInstance = usedInstance; + OctonetData* usedInstance = new OctonetData(octonetAddress, instance); + hdl = usedInstance; - m_usedInstances.emplace(instanceID, usedInstance); + m_usedInstances.emplace(instance.GetID(), usedInstance); return ADDON_STATUS_OK; } return ADDON_STATUS_UNKNOWN; } -void COctonetAddon::DestroyInstance(int instanceType, - const std::string& instanceID, - KODI_HANDLE addonInstance) +void COctonetAddon::DestroyInstance(const kodi::addon::IInstanceInfo& instance, + const KODI_ADDON_INSTANCE_HDL hdl) { - if (instanceType == ADDON_INSTANCE_PVR) + if (instance.IsType(ADDON_INSTANCE_PVR)) { kodi::Log(ADDON_LOG_DEBUG, "%s: Destoying octonet pvr instance", __func__); - const auto& it = m_usedInstances.find(instanceID); + const auto& it = m_usedInstances.find(instance.GetID()); if (it != m_usedInstances.end()) { m_usedInstances.erase(it); diff --git a/src/addon.h b/src/addon.h index 6b340d0..e82692c 100644 --- a/src/addon.h +++ b/src/addon.h @@ -15,21 +15,17 @@ class OctonetData; -class ATTRIBUTE_HIDDEN COctonetAddon : public kodi::addon::CAddonBase +class ATTR_DLL_LOCAL COctonetAddon : public kodi::addon::CAddonBase { public: COctonetAddon() = default; ADDON_STATUS SetSetting(const std::string& settingName, - const kodi::CSettingValue& settingValue) override; - ADDON_STATUS CreateInstance(int instanceType, - const std::string& instanceID, - KODI_HANDLE instance, - const std::string& version, - KODI_HANDLE& addonInstance) override; - void DestroyInstance(int instanceType, - const std::string& instanceID, - KODI_HANDLE addonInstance) override; + const kodi::addon::CSettingValue& settingValue) override; + ADDON_STATUS CreateInstance(const kodi::addon::IInstanceInfo& instance, + KODI_ADDON_INSTANCE_HDL& hdl) override; + void DestroyInstance(const kodi::addon::IInstanceInfo& instance, + const KODI_ADDON_INSTANCE_HDL hdl) override; private: std::unordered_map m_usedInstances; From 2a4230567c93ffb6e1e1ed332c0bb742b3ed8cfc Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Tue, 28 Dec 2021 13:27:27 +0100 Subject: [PATCH 2/2] increase version to 20.2.0 --- pvr.octonet/addon.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvr.octonet/addon.xml.in b/pvr.octonet/addon.xml.in index 600864f..339ec71 100644 --- a/pvr.octonet/addon.xml.in +++ b/pvr.octonet/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@