Compare commits

..

3 Commits

Author SHA1 Message Date
Kai Sommerfeld
80ea2539ec Merge pull request #53 from AlwinEsch/Matrix-change
[Matrix] final Matrix change to correct test builds and take as Version 19.0.0
2021-09-19 10:33:29 +02:00
Alwin Esch
fcb500b4df increase version to 19.0.0 (see note below)
With start of Kodi 20 Nexus, takes addon as major the same version number as Kodi.
This done to know easier to which Kodi the addon works.

For here now used by Kodi 19 Matrix.
2021-09-19 09:52:42 +02:00
Alwin Esch
43b1881487 change test builds to 'Kodi Matrix' 2021-09-19 09:52:19 +02:00
14 changed files with 175 additions and 72 deletions

View File

@@ -11,26 +11,33 @@ jobs:
matrix: matrix:
include: include:
- name: "Debian package test" - name: "Debian package test"
os: ubuntu-latest os: ubuntu-18.04
CC: gcc CC: gcc
CXX: g++ CXX: g++
DEBIAN_BUILD: true DEBIAN_BUILD: true
- os: ubuntu-18.04
CC: gcc
CXX: g++
- os: ubuntu-18.04
CC: clang
CXX: clang++
- os: macos-10.15
steps: steps:
- name: Install needed ubuntu depends - name: Install needed ubuntu depends
env: env:
DEBIAN_BUILD: ${{ matrix.DEBIAN_BUILD }} DEBIAN_BUILD: ${{ matrix.DEBIAN_BUILD }}
run: | run: |
if [[ $DEBIAN_BUILD == true ]]; then sudo add-apt-repository -y ppa:team-xbmc/xbmc-nightly; fi if [[ $DEBIAN_BUILD == true ]]; then sudo add-apt-repository -y ppa:team-xbmc/ppa; fi
if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get update; fi if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get update; fi
if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get install fakeroot; fi if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get install fakeroot; fi
- name: Checkout Kodi repo - name: Checkout Kodi repo
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
repository: xbmc/xbmc repository: xbmc/xbmc
ref: Nexus ref: Matrix
path: xbmc path: xbmc
- name: Checkout add-on repo - name: Checkout pvr.argustv repo
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
path: ${{ env.app_id }} path: ${{ env.app_id }}
- name: Configure - name: Configure
@@ -41,7 +48,7 @@ jobs:
run: | run: |
if [[ $DEBIAN_BUILD != true ]]; then cd ${app_id} && mkdir -p build && cd build; fi if [[ $DEBIAN_BUILD != true ]]; then cd ${app_id} && mkdir -p build && cd build; fi
if [[ $DEBIAN_BUILD != true ]]; then cmake -DADDONS_TO_BUILD=${app_id} -DADDON_SRC_PREFIX=${{ github.workspace }} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/xbmc/addons -DPACKAGE_ZIP=1 ${{ github.workspace }}/xbmc/cmake/addons; fi if [[ $DEBIAN_BUILD != true ]]; then cmake -DADDONS_TO_BUILD=${app_id} -DADDON_SRC_PREFIX=${{ github.workspace }} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/xbmc/addons -DPACKAGE_ZIP=1 ${{ github.workspace }}/xbmc/cmake/addons; fi
if [[ $DEBIAN_BUILD == true ]]; then wget https://raw.githubusercontent.com/xbmc/xbmc/Nexus/xbmc/addons/kodi-dev-kit/tools/debian-addon-package-test.sh && chmod +x ./debian-addon-package-test.sh; fi if [[ $DEBIAN_BUILD == true ]]; then wget https://raw.githubusercontent.com/xbmc/xbmc/Matrix/xbmc/addons/kodi-dev-kit/tools/debian-addon-package-test.sh && chmod +x ./debian-addon-package-test.sh; fi
if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get build-dep ${{ github.workspace }}/${app_id}; fi if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get build-dep ${{ github.workspace }}/${app_id}; fi
- name: Build - name: Build
env: env:

View File

@@ -39,29 +39,28 @@ jobs:
# Checkout the current repository into a directory (repositories name) # Checkout the current repository into a directory (repositories name)
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
path: ${{ github.event.repository.name }} path: ${{ github.event.repository.name }}
# Checkout the required scripts from xbmc/binary-addon-scripts into the 'scripts' directory # Checkout the required scripts from kodi-pvr/pvr-scripts into the 'scripts' directory
- name: Checkout Scripts - name: Checkout Scripts
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
repository: xbmc/binary-addon-scripts repository: kodi-pvr/pvr-scripts
path: scripts path: scripts
# Install all dependencies required by the following steps # Install all dependencies required by the following steps
# - libxml2-utils, xmlstarlet: reading news and version from addon.xml.in # - libxml2-utils, xmlstarlet: reading news and version from addon.xml.in
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update
sudo apt-get install libxml2-utils xmlstarlet sudo apt-get install libxml2-utils xmlstarlet
# Setup python version 3.9 # Setup python version 3.9
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v2
with: with:
python-version: '3.9' python-version: '3.9'
@@ -85,7 +84,6 @@ jobs:
# - steps.required-variables.outputs.version: version element from addon.xml.in # - steps.required-variables.outputs.version: version element from addon.xml.in
# - steps.required-variables.outputs.branch: branch of the triggering ref # - steps.required-variables.outputs.branch: branch of the triggering ref
# - steps.required-variables.outputs.today: today's date in format '%Y-%m-%d' # - steps.required-variables.outputs.today: today's date in format '%Y-%m-%d'
# Note: we use a random EOF for 'changes' as is best practice for for multiline variables
- name: Get required variables - name: Get required variables
id: required-variables id: required-variables
run: | run: |
@@ -94,15 +92,17 @@ jobs:
then then
changes=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/extension/news)' | awk -v RS= 'NR==1') changes=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/extension/news)' | awk -v RS= 'NR==1')
fi fi
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) changes="${changes//'%'/'%25'}"
echo "changes<<$EOF" >> $GITHUB_OUTPUT changes="${changes//$'\n'/'%0A'}"
echo "$changes" >> $GITHUB_OUTPUT changes="${changes//$'\r'/'%0D'}"
echo "$EOF" >> $GITHUB_OUTPUT changes="${changes//$'\\n'/'%0A'}"
changes="${changes//$'\\r'/'%0D'}"
echo ::set-output name=changes::$changes
version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)') version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)')
echo "version=$version" >> $GITHUB_OUTPUT echo ::set-output name=version::$version
branch=$(echo ${GITHUB_REF#refs/heads/}) branch=$(echo ${GITHUB_REF#refs/heads/})
echo "branch=$branch" >> $GITHUB_OUTPUT echo ::set-output name=branch::$branch
echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT echo ::set-output name=today::$(date +'%Y-%m-%d')
working-directory: ${{ github.event.repository.name }} working-directory: ${{ github.event.repository.name }}
# Create a commit of the incremented version and changelog, news changes # Create a commit of the incremented version and changelog, news changes
@@ -133,7 +133,7 @@ jobs:
shell: bash shell: bash
# Create a release at {steps.required-variables.outputs.branch} # Create a release at {steps.required-variables.outputs.branch}
# - tag and release name format: {steps.required-variables.outputs.version}-{steps.required-variables.outputs.branch} ie. 20.0.0-Nexus # - tag and release name format: {steps.required-variables.outputs.version}-{steps.required-variables.outputs.branch} ie. 1.0.0-Matrix
# - release body: {steps.required-variables.outputs.changes} # - release body: {steps.required-variables.outputs.changes}
- name: Create Release - name: Create Release
id: create-release id: create-release

View File

@@ -15,20 +15,20 @@ jobs:
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
path: ${{ github.event.repository.name }} path: ${{ github.event.repository.name }}
- name: Checkout Scripts - name: Checkout Scripts
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
repository: xbmc/weblate-supplementary-scripts repository: xbmc/weblate-supplementary-scripts
path: scripts path: scripts
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v2
with: with:
python-version: '3.9' python-version: '3.9'
@@ -42,14 +42,13 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update
sudo apt-get install libxml2-utils xmlstarlet sudo apt-get install libxml2-utils xmlstarlet
- name: Get required variables - name: Get required variables
id: required-variables id: required-variables
run: | run: |
version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)') version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)')
echo "version=$version" >> $GITHUB_OUTPUT echo ::set-output name=version::$version
working-directory: ${{ github.event.repository.name }} working-directory: ${{ github.event.repository.name }}
- name: Create PR for incrementing add-on versions - name: Create PR for incrementing add-on versions

View File

@@ -14,7 +14,7 @@ jobs:
# Checkout the current repository into a directory (repositories name) # Checkout the current repository into a directory (repositories name)
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
path: ${{ github.event.repository.name }} path: ${{ github.event.repository.name }}
@@ -23,14 +23,12 @@ jobs:
# - libxml2-utils, xmlstarlet: reading news and version from addon.xml.in # - libxml2-utils, xmlstarlet: reading news and version from addon.xml.in
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update
sudo apt-get install libxml2-utils xmlstarlet sudo apt-get install libxml2-utils xmlstarlet
# Create the variables required by the following steps # Create the variables required by the following steps
# - steps.required-variables.outputs.changes: latest entry in the changelog.txt (if exists), or addon.xml.in news element # - steps.required-variables.outputs.changes: latest entry in the changelog.txt (if exists), or addon.xml.in news element
# - steps.required-variables.outputs.version: version element from addon.xml.in # - steps.required-variables.outputs.version: version element from addon.xml.in
# - steps.required-variables.outputs.branch: branch of the triggering ref # - steps.required-variables.outputs.branch: branch of the triggering ref
# Note: we use a random EOF for 'changes' as is best practice for for multiline variables
- name: Get required variables - name: Get required variables
id: required-variables id: required-variables
run: | run: |
@@ -39,18 +37,20 @@ jobs:
then then
changes=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/extension/news)' | awk -v RS= 'NR==1') changes=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/extension/news)' | awk -v RS= 'NR==1')
fi fi
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) changes="${changes//'%'/'%25'}"
echo "changes<<$EOF" >> $GITHUB_OUTPUT changes="${changes//$'\n'/'%0A'}"
echo "$changes" >> $GITHUB_OUTPUT changes="${changes//$'\r'/'%0D'}"
echo "$EOF" >> $GITHUB_OUTPUT changes="${changes//$'\\n'/'%0A'}"
changes="${changes//$'\\r'/'%0D'}"
echo ::set-output name=changes::$changes
version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)') version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)')
echo "version=$version" >> $GITHUB_OUTPUT echo ::set-output name=version::$version
branch=$(echo ${GITHUB_REF#refs/heads/}) branch=$(echo ${GITHUB_REF#refs/heads/})
echo "branch=$branch" >> $GITHUB_OUTPUT echo ::set-output name=branch::$branch
working-directory: ${{ github.event.repository.name }} working-directory: ${{ github.event.repository.name }}
# Create a release at {steps.required-variables.outputs.branch} # Create a release at {steps.required-variables.outputs.branch}
# - tag and release name format: {steps.required-variables.outputs.version}-{steps.required-variables.outputs.branch} ie. 20.0.0-Nexus # - tag and release name format: {steps.required-variables.outputs.version}-{steps.required-variables.outputs.branch} ie. 1.0.0-Matrix
# - release body: {steps.required-variables.outputs.changes} # - release body: {steps.required-variables.outputs.changes}
- name: Create Release - name: Create Release
id: create-release id: create-release

View File

@@ -9,7 +9,7 @@ on:
jobs: jobs:
default: default:
if: github.repository == 'kodi-pvr/pvr.octonet' if: github.repository == 'DigitalDevices/pvr.octonet'
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@@ -21,18 +21,18 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
path: project path: project
- name: Checkout sync_addon_metadata_translations repository - name: Checkout sync_addon_metadata_translations repository
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
repository: xbmc/sync_addon_metadata_translations repository: xbmc/sync_addon_metadata_translations
path: sync_addon_metadata_translations path: sync_addon_metadata_translations
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
@@ -55,4 +55,3 @@ jobs:
branch: amt-sync branch: amt-sync
delete-branch: true delete-branch: true
path: ./project path: ./project
reviewers: gade01

54
.travis.yml Normal file
View File

@@ -0,0 +1,54 @@
language: cpp
#
# Define the builds to get up to date versions of cmake and gcc
#
env:
global:
- app_id=pvr.octonet
matrix:
include:
- os: linux
dist: bionic
sudo: required
compiler: gcc
- os: linux
dist: bionic
sudo: required
compiler: clang
- os: linux
dist: bionic
sudo: required
compiler: gcc
env: DEBIAN_BUILD=true
- os: linux
dist: focal
sudo: required
compiler: gcc
env: DEBIAN_BUILD=true
- os: osx
osx_image: xcode10.2
before_install:
- if [[ $DEBIAN_BUILD == true ]]; then sudo add-apt-repository -y ppa:team-xbmc/ppa; fi
- if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get update; fi
- if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get install fakeroot; fi
#
# The addon source is automatically checked out in $TRAVIS_BUILD_DIR,
# we'll put the Kodi source on the same level
#
before_script:
- if [[ $DEBIAN_BUILD != true ]]; then cd $TRAVIS_BUILD_DIR/..; fi
- if [[ $DEBIAN_BUILD != true ]]; then git clone --branch Matrix --depth=1 https://github.com/xbmc/xbmc.git; fi
- if [[ $DEBIAN_BUILD != true ]]; then cd ${app_id} && mkdir build && cd build; fi
- if [[ $DEBIAN_BUILD != true ]]; then mkdir -p definition/${app_id}; fi
- if [[ $DEBIAN_BUILD != true ]]; then echo ${app_id} $TRAVIS_BUILD_DIR $TRAVIS_COMMIT > definition/${app_id}/${app_id}.txt; fi
- if [[ $DEBIAN_BUILD != true ]]; then cmake -DADDONS_TO_BUILD=${app_id} -DADDON_SRC_PREFIX=$TRAVIS_BUILD_DIR/.. -DADDONS_DEFINITION_DIR=$TRAVIS_BUILD_DIR/build/definition -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/../xbmc/addons -DPACKAGE_ZIP=1 $TRAVIS_BUILD_DIR/../xbmc/cmake/addons; fi
- if [[ $DEBIAN_BUILD == true ]]; then wget https://raw.githubusercontent.com/xbmc/xbmc/Matrix/xbmc/addons/kodi-dev-kit/tools/debian-addon-package-test.sh && chmod +x ./debian-addon-package-test.sh; fi
- if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get build-dep $TRAVIS_BUILD_DIR; fi
script:
- if [[ $DEBIAN_BUILD != true ]]; then make; fi
- if [[ $DEBIAN_BUILD == true ]]; then ./debian-addon-package-test.sh $TRAVIS_BUILD_DIR; fi

2
Jenkinsfile vendored
View File

@@ -1 +1 @@
buildPlugin(version: "Nexus") buildPlugin(version: "Matrix")

View File

@@ -1,9 +1,10 @@
# Octonet PVR # Octonet PVR
Digital Devices [Octonet](http://www.digital-devices.eu/shop/de/netzwerk-tv/) PVR client addon for [Kodi](http://kodi.tv) Digital Devices [Octonet](http://www.digital-devices.eu/shop/de/netzwerk-tv/) PVR client addon for [Kodi](http://kodi.tv)
[![License: GPL-2.0-or-later](https://img.shields.io/badge/License-GPL%20v2+-blue.svg)](LICENSE.md) | Platform | Status |
[![Build and run tests](https://github.com/DigitalDevices/pvr.octonet/actions/workflows/build.yml/badge.svg?branch=Nexus)](https://github.com/DigitalDevices/pvr.octonet/actions/workflows/build.yml) |----------|--------|
[![Build Status](https://jenkins.kodi.tv/view/Addons/job/DigitalDevices/job/pvr.octonet/job/Nexus/badge/icon)](https://jenkins.kodi.tv/blue/organizations/jenkins/DigitalDevices%2Fpvr.octonet/branches/) | Linux + OS X (github) | [![Build and run tests](https://github.com/kodi-pvr/pvr.octonet/actions/workflows/build.yml/badge.svg?branch=Matrix)](https://github.com/kodi-pvr/pvr.octonet/actions/workflows/build.yml) |
| Windows (AppVeyor) | [![Build status](https://ci.appveyor.com/api/projects/status/m7dhmpmuf5coir5h?svg=true)](https://ci.appveyor.com/project/julianscheel/pvr-octonet) |
# Building # Building
@@ -13,13 +14,13 @@ adjusted according to your OS (`/` vs `\`). We use Linux paths here as an exampl
Clone the `pvr.octonet` repository: Clone the `pvr.octonet` repository:
``` ```
$ git clone https://github.com/DigitalDevices/pvr.octonet.git $ git clone --branch Matrix https://github.com/DigitalDevices/pvr.octonet.git
``` ```
Clone the Kodi repository: Clone the Kodi repository:
``` ```
$ git clone --branch master https://github.com/xbmc/xbmc.git $ git clone --branch Matrix https://github.com/xbmc/xbmc.git
``` ```
``` ```

33
appveyor.yml Normal file
View File

@@ -0,0 +1,33 @@
version: BuildNr.{build}
image: Visual Studio 2017
shallow_clone: true
clone_folder: c:\projects\pvr.octonet
environment:
app_id: pvr.octonet
matrix:
- GENERATOR: "Visual Studio 15"
CONFIG: Release
- GENERATOR: "Visual Studio 15 Win64"
CONFIG: Release
- GENERATOR: "Visual Studio 15 Win64"
CONFIG: Release
WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0"
- GENERATOR: "Visual Studio 15 ARM"
CONFIG: Release
WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0"
build_script:
- cd ..
- git clone --branch Matrix --depth=1 https://github.com/xbmc/xbmc.git
- cd %app_id%
- mkdir build
- cd build
- mkdir -p definition\%app_id%
- echo %app_id% %APPVEYOR_BUILD_FOLDER% %APPVEYOR_REPO_COMMIT% > definition\%app_id%\%app_id%.txt
- cmake -T host=x64 -G "%GENERATOR%" %WINSTORE% -DADDONS_TO_BUILD=%app_id% -DCMAKE_BUILD_TYPE=%CONFIG% -DADDONS_DEFINITION_DIR=%APPVEYOR_BUILD_FOLDER%/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons
- cmake --build . --config %CONFIG% --target %app_id%

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<addon <addon
id="pvr.octonet" id="pvr.octonet"
version="20.3.0" version="19.0.0"
name="Digital Devices Octopus NET Client" name="Digital Devices Octopus NET Client"
provider-name="digitaldevices"> provider-name="digitaldevices">
<requires>@ADDON_DEPENDS@</requires> <requires>@ADDON_DEPENDS@</requires>

View File

@@ -23,8 +23,9 @@
#endif #endif
OctonetData::OctonetData(const std::string& octonetAddress, OctonetData::OctonetData(const std::string& octonetAddress,
const kodi::addon::IInstanceInfo& instance) KODI_HANDLE instance,
: kodi::addon::CInstancePVRClient(instance) const std::string& kodiVersion)
: kodi::addon::CInstancePVRClient(instance, kodiVersion)
{ {
m_serverAddress = octonetAddress; m_serverAddress = octonetAddress;
m_channels.clear(); m_channels.clear();
@@ -32,7 +33,7 @@ OctonetData::OctonetData(const std::string& octonetAddress,
m_lastEpgLoad = 0; m_lastEpgLoad = 0;
if (!LoadChannelList()) if (!LoadChannelList())
kodi::QueueFormattedNotification(QUEUE_ERROR, kodi::addon::GetLocalizedString(30001).c_str(), kodi::QueueFormattedNotification(QUEUE_ERROR, kodi::GetLocalizedString(30001).c_str(),
m_channels.size()); m_channels.size());
/* /*

View File

@@ -43,11 +43,12 @@ struct OctonetGroup
std::vector<int> members; std::vector<int> members;
}; };
class ATTR_DLL_LOCAL OctonetData : public kodi::addon::CInstancePVRClient class ATTRIBUTE_HIDDEN OctonetData : public kodi::addon::CInstancePVRClient
{ {
public: public:
OctonetData(const std::string& octonetAddress, OctonetData(const std::string& octonetAddress,
const kodi::addon::IInstanceInfo& instance); KODI_HANDLE instance,
const std::string& kodiVersion);
~OctonetData() override; ~OctonetData() override;
PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities& capabilities) override; PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities& capabilities) override;

View File

@@ -13,41 +13,45 @@
#include "OctonetData.h" #include "OctonetData.h"
ADDON_STATUS COctonetAddon::SetSetting(const std::string& settingName, ADDON_STATUS COctonetAddon::SetSetting(const std::string& settingName,
const kodi::addon::CSettingValue& settingValue) const kodi::CSettingValue& settingValue)
{ {
/* For simplicity do a full addon restart whenever settings are /* For simplicity do a full addon restart whenever settings are
* changed */ * changed */
return ADDON_STATUS_NEED_RESTART; return ADDON_STATUS_NEED_RESTART;
} }
ADDON_STATUS COctonetAddon::CreateInstance(const kodi::addon::IInstanceInfo& instance, ADDON_STATUS COctonetAddon::CreateInstance(int instanceType,
KODI_ADDON_INSTANCE_HDL& hdl) const std::string& instanceID,
KODI_HANDLE instance,
const std::string& version,
KODI_HANDLE& addonInstance)
{ {
if (instance.IsType(ADDON_INSTANCE_PVR)) if (instanceType == ADDON_INSTANCE_PVR)
{ {
kodi::Log(ADDON_LOG_DEBUG, "%s: Creating octonet pvr instance", __func__); kodi::Log(ADDON_LOG_DEBUG, "%s: Creating octonet pvr instance", __func__);
/* IP or hostname of the octonet to be connected to */ /* IP or hostname of the octonet to be connected to */
std::string octonetAddress = kodi::addon::GetSettingString("octonetAddress"); std::string octonetAddress = kodi::GetSettingString("octonetAddress");
OctonetData* usedInstance = new OctonetData(octonetAddress, instance); OctonetData* usedInstance = new OctonetData(octonetAddress, instance, version);
hdl = usedInstance; addonInstance = usedInstance;
m_usedInstances.emplace(instance.GetID(), usedInstance); m_usedInstances.emplace(instanceID, usedInstance);
return ADDON_STATUS_OK; return ADDON_STATUS_OK;
} }
return ADDON_STATUS_UNKNOWN; return ADDON_STATUS_UNKNOWN;
} }
void COctonetAddon::DestroyInstance(const kodi::addon::IInstanceInfo& instance, void COctonetAddon::DestroyInstance(int instanceType,
const KODI_ADDON_INSTANCE_HDL hdl) const std::string& instanceID,
KODI_HANDLE addonInstance)
{ {
if (instance.IsType(ADDON_INSTANCE_PVR)) if (instanceType == ADDON_INSTANCE_PVR)
{ {
kodi::Log(ADDON_LOG_DEBUG, "%s: Destoying octonet pvr instance", __func__); kodi::Log(ADDON_LOG_DEBUG, "%s: Destoying octonet pvr instance", __func__);
const auto& it = m_usedInstances.find(instance.GetID()); const auto& it = m_usedInstances.find(instanceID);
if (it != m_usedInstances.end()) if (it != m_usedInstances.end())
{ {
m_usedInstances.erase(it); m_usedInstances.erase(it);

View File

@@ -15,17 +15,21 @@
class OctonetData; class OctonetData;
class ATTR_DLL_LOCAL COctonetAddon : public kodi::addon::CAddonBase class ATTRIBUTE_HIDDEN COctonetAddon : public kodi::addon::CAddonBase
{ {
public: public:
COctonetAddon() = default; COctonetAddon() = default;
ADDON_STATUS SetSetting(const std::string& settingName, ADDON_STATUS SetSetting(const std::string& settingName,
const kodi::addon::CSettingValue& settingValue) override; const kodi::CSettingValue& settingValue) override;
ADDON_STATUS CreateInstance(const kodi::addon::IInstanceInfo& instance, ADDON_STATUS CreateInstance(int instanceType,
KODI_ADDON_INSTANCE_HDL& hdl) override; const std::string& instanceID,
void DestroyInstance(const kodi::addon::IInstanceInfo& instance, KODI_HANDLE instance,
const KODI_ADDON_INSTANCE_HDL hdl) override; const std::string& version,
KODI_HANDLE& addonInstance) override;
void DestroyInstance(int instanceType,
const std::string& instanceID,
KODI_HANDLE addonInstance) override;
private: private:
std::unordered_map<std::string, OctonetData*> m_usedInstances; std::unordered_map<std::string, OctonetData*> m_usedInstances;