diff -Nru kodi-pvr-waipu-20.11.0/.github/workflows/build.yml kodi-pvr-waipu-20.12.0/.github/workflows/build.yml --- kodi-pvr-waipu-20.11.0/.github/workflows/build.yml 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/.github/workflows/build.yml 2013-05-31 22:59:22.000000000 +0000 @@ -24,13 +24,13 @@ if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get update; fi if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get install fakeroot; fi - name: Checkout Kodi repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: xbmc/xbmc ref: Nexus path: xbmc - - name: Checkout pvr.waipu repo - uses: actions/checkout@v2 + - name: Checkout add-on repo + uses: actions/checkout@v4 with: path: ${{ env.app_id }} - name: Configure @@ -41,7 +41,7 @@ run: | 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 wget https://raw.githubusercontent.com/xbmc/xbmc/master/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/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 sudo apt-get build-dep ${{ github.workspace }}/${app_id}; fi - name: Build env: diff -Nru kodi-pvr-waipu-20.11.0/.github/workflows/changelog-and-release.yml kodi-pvr-waipu-20.12.0/.github/workflows/changelog-and-release.yml --- kodi-pvr-waipu-20.11.0/.github/workflows/changelog-and-release.yml 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/.github/workflows/changelog-and-release.yml 2013-05-31 22:59:22.000000000 +0000 @@ -39,28 +39,29 @@ # Checkout the current repository into a directory (repositories name) - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 path: ${{ github.event.repository.name }} - # Checkout the required scripts from kodi-pvr/pvr-scripts into the 'scripts' directory + # Checkout the required scripts from xbmc/binary-addon-scripts into the 'scripts' directory - name: Checkout Scripts - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - repository: kodi-pvr/pvr-scripts + repository: xbmc/binary-addon-scripts path: scripts # Install all dependencies required by the following steps # - libxml2-utils, xmlstarlet: reading news and version from addon.xml.in - name: Install dependencies run: | + sudo apt-get update sudo apt-get install libxml2-utils xmlstarlet # Setup python version 3.9 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.9' @@ -84,6 +85,7 @@ # - 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.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 id: required-variables run: | @@ -92,17 +94,15 @@ then changes=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/extension/news)' | awk -v RS= 'NR==1') fi - changes="${changes//'%'/'%25'}" - changes="${changes//$'\n'/'%0A'}" - changes="${changes//$'\r'/'%0D'}" - changes="${changes//$'\\n'/'%0A'}" - changes="${changes//$'\\r'/'%0D'}" - echo ::set-output name=changes::$changes + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "changes<<$EOF" >> $GITHUB_OUTPUT + echo "$changes" >> $GITHUB_OUTPUT + echo "$EOF" >> $GITHUB_OUTPUT version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)') - echo ::set-output name=version::$version + echo "version=$version" >> $GITHUB_OUTPUT branch=$(echo ${GITHUB_REF#refs/heads/}) - echo ::set-output name=branch::$branch - echo ::set-output name=today::$(date +'%Y-%m-%d') + echo "branch=$branch" >> $GITHUB_OUTPUT + echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT working-directory: ${{ github.event.repository.name }} # Create a commit of the incremented version and changelog, news changes diff -Nru kodi-pvr-waipu-20.11.0/.github/workflows/increment-version.yml kodi-pvr-waipu-20.12.0/.github/workflows/increment-version.yml --- kodi-pvr-waipu-20.11.0/.github/workflows/increment-version.yml 1970-01-01 00:00:00.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/.github/workflows/increment-version.yml 2013-05-31 22:59:22.000000000 +0000 @@ -0,0 +1,63 @@ +name: Increment version when languages are updated + +on: + push: + branches: [ Matrix, Nexus ] + paths: + - '**resource.language.**strings.po' + +jobs: + default: + if: github.repository == 'flubshi/pvr.waipu' + runs-on: ubuntu-latest + name: Increment add-on version when languages are updated + + steps: + + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: ${{ github.event.repository.name }} + + - name: Checkout Scripts + uses: actions/checkout@v4 + with: + fetch-depth: 0 + repository: xbmc/weblate-supplementary-scripts + path: scripts + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: Get changed files + uses: trilom/file-changes-action@v1.2.4 + + - name: Increment add-on version + run: | + python3 ../scripts/binary/increment_version.py $HOME/files.json -c -n + working-directory: ${{ github.event.repository.name }} + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install libxml2-utils xmlstarlet + + - name: Get required variables + id: required-variables + run: | + version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)') + echo "version=$version" >> $GITHUB_OUTPUT + working-directory: ${{ github.event.repository.name }} + + - name: Create PR for incrementing add-on versions + uses: peter-evans/create-pull-request@v3.10.0 + with: + commit-message: Add-on version incremented to ${{ steps.required-variables.outputs.version }} from Weblate + title: Add-on version incremented to ${{ steps.required-variables.outputs.version }} from Weblate + body: Add-on version incremented triggered by ${{ github.sha }} + branch: inc-ver + delete-branch: true + path: ./${{ github.event.repository.name }} diff -Nru kodi-pvr-waipu-20.11.0/.github/workflows/release.yml kodi-pvr-waipu-20.12.0/.github/workflows/release.yml --- kodi-pvr-waipu-20.11.0/.github/workflows/release.yml 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/.github/workflows/release.yml 2013-05-31 22:59:22.000000000 +0000 @@ -14,7 +14,7 @@ # Checkout the current repository into a directory (repositories name) - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 path: ${{ github.event.repository.name }} @@ -30,6 +30,7 @@ # - 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.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 id: required-variables run: | @@ -38,16 +39,14 @@ then changes=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/extension/news)' | awk -v RS= 'NR==1') fi - changes="${changes//'%'/'%25'}" - changes="${changes//$'\n'/'%0A'}" - changes="${changes//$'\r'/'%0D'}" - changes="${changes//$'\\n'/'%0A'}" - changes="${changes//$'\\r'/'%0D'}" - echo ::set-output name=changes::$changes + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "changes<<$EOF" >> $GITHUB_OUTPUT + echo "$changes" >> $GITHUB_OUTPUT + echo "$EOF" >> $GITHUB_OUTPUT version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)') - echo ::set-output name=version::$version + echo "version=$version" >> $GITHUB_OUTPUT branch=$(echo ${GITHUB_REF#refs/heads/}) - echo ::set-output name=branch::$branch + echo "branch=$branch" >> $GITHUB_OUTPUT working-directory: ${{ github.event.repository.name }} # Create a release at {steps.required-variables.outputs.branch} diff -Nru kodi-pvr-waipu-20.11.0/.github/workflows/sync-addon-metadata-translations.yml kodi-pvr-waipu-20.12.0/.github/workflows/sync-addon-metadata-translations.yml --- kodi-pvr-waipu-20.11.0/.github/workflows/sync-addon-metadata-translations.yml 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/.github/workflows/sync-addon-metadata-translations.yml 2013-05-31 22:59:22.000000000 +0000 @@ -2,14 +2,14 @@ on: push: - branches: [ Nexus ] + branches: [ Matrix, Nexus ] paths: - '**addon.xml.in' - '**resource.language.**strings.po' jobs: default: - if: github.repository == 'flubshi/pvr.waipu' + if: github.repository == 'kodi-pvr/pvr.waipu' runs-on: ubuntu-latest strategy: @@ -21,18 +21,18 @@ steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: project - name: Checkout sync_addon_metadata_translations repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: xbmc/sync_addon_metadata_translations path: sync_addon_metadata_translations - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -55,3 +55,4 @@ branch: amt-sync delete-branch: true path: ./project + reviewers: gade01 diff -Nru kodi-pvr-waipu-20.11.0/debian/changelog kodi-pvr-waipu-20.12.0/debian/changelog --- kodi-pvr-waipu-20.11.0/debian/changelog 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/debian/changelog 2013-05-31 22:59:22.000000000 +0000 @@ -1,4 +1,4 @@ -kodi-pvr-waipu (6:20.11.0-1~focal) focal; urgency=low +kodi-pvr-waipu (6:20.12.0-1~focal) focal; urgency=low [ kodi ] * autogenerated dummy changelog diff -Nru kodi-pvr-waipu-20.11.0/pvr.waipu/addon.xml.in kodi-pvr-waipu-20.12.0/pvr.waipu/addon.xml.in --- kodi-pvr-waipu-20.11.0/pvr.waipu/addon.xml.in 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/pvr.waipu/addon.xml.in 2013-05-31 22:59:22.000000000 +0000 @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ @@ -26,7 +26,8 @@ resources/screenshots/screenshot-02.jpg -- Allow restart of program that is not running anymore but started max 1 hour in the past +- Fix channel handling to add support for recently added channels +- Improve handling on system wake up waipu.tv PVR-klient waipu.tv PVR Client diff -Nru kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.de_de/strings.po kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.de_de/strings.po --- kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.de_de/strings.po 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.de_de/strings.po 2013-05-31 22:59:22.000000000 +0000 @@ -5,7 +5,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@kodi.tv\n" -"PO-Revision-Date: 2023-10-10 15:24+0000\n" +"PO-Revision-Date: 2024-01-28 23:13+0000\n" "Last-Translator: Kai Sommerfeld \n" "Language-Team: German \n" "Language: de_de\n" @@ -13,7 +13,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.0.2\n" +"X-Generator: Weblate 5.3\n" msgctxt "Addon Summary" msgid "waipu.tv PVR Client" @@ -161,15 +161,15 @@ msgctxt "#30042" msgid "EPG preview images" -msgstr "" +msgstr "EPG-Vorschaubilder" msgctxt "#30043" msgid "Import Channels" -msgstr "" +msgstr "Sender importieren" msgctxt "#30044" msgid "All visible" -msgstr "" +msgstr "Alle sichtbaren" msgctxt "#30045" msgid "All" @@ -185,15 +185,15 @@ msgctxt "#30048" msgid "HLS: Use inputstream.ffmpegdirect" -msgstr "" +msgstr "HLS: inputstream.adaptive verwenden" msgctxt "#30500" msgid "Inputstream error" -msgstr "" +msgstr "Inputstream-Fehler" msgctxt "#30501" msgid "The %s addon is not installed." -msgstr "Das Addon %s ist nicht installiert." +msgstr "Das Addon %s ist nicht installirt." msgctxt "#30502" msgid "The %s addon is not enabled." diff -Nru kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.fr_fr/strings.po kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.fr_fr/strings.po --- kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.fr_fr/strings.po 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.fr_fr/strings.po 2013-05-31 22:59:22.000000000 +0000 @@ -5,15 +5,15 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@kodi.tv\n" -"PO-Revision-Date: 2023-12-12 13:11+0000\n" -"Last-Translator: Azgar \n" +"PO-Revision-Date: 2024-02-21 16:13+0000\n" +"Last-Translator: skypichat \n" "Language-Team: French (France) \n" "Language: fr_fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 5.2.1\n" +"X-Generator: Weblate 5.4\n" msgctxt "Addon Summary" msgid "waipu.tv PVR Client" @@ -173,7 +173,7 @@ msgctxt "#30045" msgid "All" -msgstr "Toutes" +msgstr "Tout" msgctxt "#30046" msgid "Favourites" diff -Nru kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.it_it/strings.po kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.it_it/strings.po --- kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.it_it/strings.po 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.it_it/strings.po 2013-05-31 22:59:22.000000000 +0000 @@ -5,7 +5,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@kodi.tv\n" -"PO-Revision-Date: 2023-09-27 18:06+0000\n" +"PO-Revision-Date: 2024-04-14 04:58+0000\n" "Last-Translator: Massimo Pissarello \n" "Language-Team: Italian \n" "Language: it_it\n" @@ -13,7 +13,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.0.2\n" +"X-Generator: Weblate 5.4.3\n" msgctxt "Addon Summary" msgid "waipu.tv PVR Client" @@ -189,7 +189,7 @@ msgctxt "#30500" msgid "Inputstream error" -msgstr "Errore stream in ingresso" +msgstr "Errore Inputstream" msgctxt "#30501" msgid "The %s addon is not installed." diff -Nru kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.ko_kr/strings.po kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.ko_kr/strings.po --- kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.ko_kr/strings.po 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.ko_kr/strings.po 2013-05-31 22:59:22.000000000 +0000 @@ -5,7 +5,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@kodi.tv\n" -"PO-Revision-Date: 2023-10-19 09:11+0000\n" +"PO-Revision-Date: 2024-01-14 08:13+0000\n" "Last-Translator: Minho Park \n" "Language-Team: Korean \n" "Language: ko_kr\n" @@ -13,7 +13,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 5.0.2\n" +"X-Generator: Weblate 5.3\n" msgctxt "Addon Summary" msgid "waipu.tv PVR Client" @@ -189,7 +189,7 @@ msgctxt "#30500" msgid "Inputstream error" -msgstr "Inputstream 오류" +msgstr "입력 스트림 오류" msgctxt "#30501" msgid "The %s addon is not installed." @@ -197,4 +197,4 @@ msgctxt "#30502" msgid "The %s addon is not enabled." -msgstr "%s 애드온이 사용되지 않았습니다." +msgstr "%s 애드온을 사용하지 않습니다." diff -Nru kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.pt_br/strings.po kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.pt_br/strings.po --- kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.pt_br/strings.po 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.pt_br/strings.po 2013-05-31 22:59:22.000000000 +0000 @@ -5,15 +5,15 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@kodi.tv\n" -"PO-Revision-Date: 2023-05-24 15:31+0000\n" -"Last-Translator: Christian Gade \n" +"PO-Revision-Date: 2024-01-28 23:13+0000\n" +"Last-Translator: icarok99 \n" "Language-Team: Portuguese (Brazil) \n" "Language: pt_br\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.17\n" +"X-Generator: Weblate 5.3\n" msgctxt "Addon Summary" msgid "waipu.tv PVR Client" @@ -189,12 +189,12 @@ msgctxt "#30500" msgid "Inputstream error" -msgstr "" +msgstr "Erro no inputstream" msgctxt "#30501" msgid "The %s addon is not installed." -msgstr "" +msgstr "O addon %s não está instalado." msgctxt "#30502" msgid "The %s addon is not enabled." -msgstr "" +msgstr "O addon %s não está ativado." diff -Nru kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.ru_ru/strings.po kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.ru_ru/strings.po --- kodi-pvr-waipu-20.11.0/pvr.waipu/resources/language/resource.language.ru_ru/strings.po 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/pvr.waipu/resources/language/resource.language.ru_ru/strings.po 2013-05-31 22:59:22.000000000 +0000 @@ -5,15 +5,15 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: translations@kodi.tv\n" -"PO-Revision-Date: 2023-10-28 00:11+0000\n" -"Last-Translator: Christian Gade \n" +"PO-Revision-Date: 2024-02-29 08:13+0000\n" +"Last-Translator: Alexey \n" "Language-Team: Russian \n" "Language: ru_ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 5.1\n" +"X-Generator: Weblate 5.4\n" msgctxt "Addon Summary" msgid "waipu.tv PVR Client" @@ -161,15 +161,15 @@ msgctxt "#30042" msgid "EPG preview images" -msgstr "" +msgstr "Изображения предпросмотра EPG" msgctxt "#30043" msgid "Import Channels" -msgstr "" +msgstr "Импорт каналов" msgctxt "#30044" msgid "All visible" -msgstr "" +msgstr "Все видимые" msgctxt "#30045" msgid "All" @@ -185,7 +185,7 @@ msgctxt "#30048" msgid "HLS: Use inputstream.ffmpegdirect" -msgstr "" +msgstr "HLS: Использовать inputstream.ffmpegdirect" msgctxt "#30500" msgid "Inputstream error" diff -Nru kodi-pvr-waipu-20.11.0/src/WaipuData.cpp kodi-pvr-waipu-20.12.0/src/WaipuData.cpp --- kodi-pvr-waipu-20.11.0/src/WaipuData.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/src/WaipuData.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -753,32 +753,31 @@ return false; std::lock_guard lock(mutex); - kodi::Log(ADDON_LOG_DEBUG, "[load data] Get channels"); - std::string jsonChannels = HttpGet("https://epg.waipu.tv/api/channels"); - if (jsonChannels.empty()) + std::string stationConfigJson = HttpGet("https://web-proxy.waipu.tv/station-config"); + kodi::Log(ADDON_LOG_DEBUG, "[%s] Station config JSON: %s", __FUNCTION__, stationConfigJson.c_str()); + + rapidjson::Document stationConfigDoc; + stationConfigDoc.Parse(stationConfigJson.c_str()); + if (stationConfigDoc.HasParseError()) { - kodi::Log(ADDON_LOG_ERROR, "[channels] ERROR - empty response"); + kodi::Log(ADDON_LOG_ERROR, "[%s] Error while parsing station config JSON", __FUNCTION__); m_login_status = WAIPU_LOGIN_STATUS::UNKNOWN; return false; } - jsonChannels = "{\"result\": " + jsonChannels + "}"; - kodi::Log(ADDON_LOG_DEBUG, "[channels] length: %i;", jsonChannels.size()); - kodi::Log(ADDON_LOG_DEBUG, "[channels] %s;", jsonChannels.c_str()); - kodi::Log(ADDON_LOG_DEBUG, "[channels] %s;", - jsonChannels.substr(jsonChannels.size() - 40).c_str()); - - // parse channels - kodi::Log(ADDON_LOG_DEBUG, "[channels] parse channels"); - rapidjson::Document channelsDoc; - channelsDoc.Parse(jsonChannels.c_str()); - if (channelsDoc.HasParseError()) + const auto& stationConfigs = stationConfigDoc["stations"].GetArray(); + + std::string userStationsJson = HttpGet("https://user-stations.waipu.tv/api/stations?omitted=false"); + kodi::Log(ADDON_LOG_DEBUG, "[%s] User stations JSON: %s", __FUNCTION__, userStationsJson.c_str()); + + rapidjson::Document doc; + doc.Parse(userStationsJson.c_str()); + if (doc.HasParseError()) { - kodi::Log(ADDON_LOG_ERROR, "[LoadChannelData] ERROR: error while parsing json"); + kodi::Log(ADDON_LOG_ERROR, "[%s] Error while parsing user stations JSON", __FUNCTION__); + m_login_status = WAIPU_LOGIN_STATUS::UNKNOWN; return false; } - kodi::Log(ADDON_LOG_DEBUG, "[channels] iterate channels"); - kodi::Log(ADDON_LOG_DEBUG, "[channels] size: %i;", channelsDoc["result"].Size()); WaipuChannelGroup cgroup_fav; cgroup_fav.name = "Favoriten"; @@ -789,140 +788,79 @@ WaipuChannelGroup cgroup_vod; cgroup_vod.name = "VoD"; - int i = 0; - for (const auto& channel : channelsDoc["result"].GetArray()) + for (rapidjson::SizeType i = 0; i < doc.Size(); i++) { - const std::string waipuid = channel["id"].GetString(); - // check if channel is part of user channels: - bool isHD = false; - if (find(m_user_channels_sd.begin(), m_user_channels_sd.end(), waipuid.c_str()) != - m_user_channels_sd.end()) - { - isHD = false; - } - else if (find(m_user_channels_hd.begin(), m_user_channels_hd.end(), waipuid.c_str()) != - m_user_channels_hd.end()) - { - isHD = true; - } - else - { + const auto& channel = doc[i]; + const std::string waipuId = channel["stationId"].GetString(); + + const auto& stationConfig = std::find_if(stationConfigs.begin(), stationConfigs.end(), + [waipuId](const auto& v) { return v["id"].GetString() == waipuId; }); + if (stationConfig == stationConfigs.end()) continue; - } - bool tvfuse = false; - // check if user has hidden this channel - if (channel.HasMember("properties") && channel["properties"].IsArray()) + WaipuChannel waipuChannel; + + waipuChannel.iChannelNumber = i + 1; // position + waipuChannel.waipuID = waipuId; // waipu[id] + waipuChannel.iUniqueId = Utils::Hash(waipuId); + waipuChannel.strChannelName = channel["displayName"].GetString(); // waipu[displayName] + + std::string iconUrl = (*stationConfig)["logoTemplateUrl"].GetString(); + iconUrl = std::regex_replace(iconUrl, std::regex("\\$\\{streamQuality\\}"), channel["streamQuality"].GetString()); + iconUrl = std::regex_replace(iconUrl, std::regex("\\$\\{shape\\}"), "standard"); + iconUrl = std::regex_replace(iconUrl, std::regex("\\$\\{resolution\\}"), "320x180"); + + std::string iconPath = "special://home/addons/pvr.waipu/resources/channel_icons/" + waipuId + ".png"; + if (!kodi::vfs::FileExists(iconPath, true)) { - bool skipChannel = false; - for (auto& prop : channel["properties"].GetArray()) - { - skipChannel |= (prop.GetString() == std::string("UserSetHidden")); - tvfuse |= (prop.GetString() == std::string("tvfuse")); - } - // skip if we do not enforce to show all - if (m_channel_filter != CHANNEL_FILTER_ALL && skipChannel) - continue; + kodi::Log(ADDON_LOG_DEBUG, "[%s] Downloading channel logo %s to %s", __FUNCTION__, iconUrl.c_str(), iconPath.c_str()); + Utils::FileDownload(iconUrl, iconPath); } + waipuChannel.strIconPath = iconPath; + + const auto& userSettings = channel["userSettings"].GetObject(); + bool isFav = userSettings["favorite"].GetBool(); + bool isVisible = userSettings["visible"].GetBool(); + bool tvfuse = (*stationConfig)["newTv"].GetBool(); + waipuChannel.tvfuse = tvfuse; + + // skip if we do not enforce to show all + if (m_channel_filter != CHANNEL_FILTER_ALL && !isVisible) + continue; // Apply LiveTV filter (=!tvfuse) - if (m_channel_filter == CHANNEL_FILTER_LIVE && tvfuse) continue; + if (m_channel_filter == CHANNEL_FILTER_LIVE && tvfuse) + continue; // Apply Favourites filter - bool isFav = channel["faved"].GetBool(); - if (m_channel_filter == CHANNEL_FILTER_FAVOURITES && !isFav) continue; + if (m_channel_filter == CHANNEL_FILTER_FAVOURITES && !isFav) + continue; - ++i; - WaipuChannel waipu_channel; - waipu_channel.iChannelNumber = i; // position - kodi::Log(ADDON_LOG_DEBUG, "[channel] channelnr(pos): %i;", waipu_channel.iChannelNumber); - - waipu_channel.tvfuse = tvfuse; - kodi::Log(ADDON_LOG_DEBUG, "[channel] tvfuse: %i;", waipu_channel.tvfuse); - - waipu_channel.waipuID = waipuid; // waipu[id] - kodi::Log(ADDON_LOG_DEBUG, "[channel] waipuid: %s;", waipu_channel.waipuID.c_str()); - - const int uniqueId = Utils::Hash(waipuid); - waipu_channel.iUniqueId = uniqueId; - kodi::Log(ADDON_LOG_DEBUG, "[channel] id: %i;", uniqueId); - - const std::string displayName = channel["displayName"].GetString(); - waipu_channel.strChannelName = displayName; // waipu[displayName] - kodi::Log(ADDON_LOG_DEBUG, "[channel] name: %s;", waipu_channel.strChannelName.c_str()); - - // iterate links - std::string icon; - std::string icon_sd; - std::string icon_hd; - for (const auto& link : channel["links"].GetArray()) - { - const std::string rel = link["rel"].GetString(); - const std::string href = link["href"].GetString(); - if (rel == "icon") - { - icon = href; - continue; - } - else if (rel == "iconsd") - { - icon_sd = href; - continue; - } - else if (rel == "iconhd") - { - icon_hd = href; - continue; - } - kodi::Log(ADDON_LOG_DEBUG, "[channel] link: %s -> %s;", rel.c_str(), href.c_str()); - } + // user added channel to favorites + if (isFav) + cgroup_fav.channels.emplace_back(waipuChannel); - std::string channel_url = ""; - if (icon_hd.size() > 0 && isHD) - { - channel_url = icon_hd + "?width=256&height=256"; - } - else if (icon_sd.size() > 0) - { - channel_url = icon_sd + "?width=256&height=256"; - } - else if (icon.size() > 0) - { - channel_url = icon + "?width=256&height=256"; - } + if (tvfuse) // Video on Demand channel + cgroup_vod.channels.emplace_back(waipuChannel); + else // Not VoD -> Live TV + cgroup_live.channels.emplace_back(waipuChannel); - std::string iconPath = "special://home/addons/pvr.waipu/resources/channel_icons/" + waipu_channel.waipuID + ".png"; - if (!kodi::vfs::FileExists(iconPath, true)) - { - kodi::Log(ADDON_LOG_DEBUG, "[channel] download channel logo: %s -> %s", channel_url.c_str(), iconPath.c_str()); - Utils::FileDownload(channel_url, iconPath); - } - waipu_channel.strIconPath = iconPath; - kodi::Log(ADDON_LOG_DEBUG, "[channel] selected channel logo: %s", waipu_channel.strIconPath.c_str()); - if (isFav) - { - // user added channel to favorites - cgroup_fav.channels.emplace_back(waipu_channel); - } - if (tvfuse) - { - // Video on Demand channel - cgroup_vod.channels.emplace_back(waipu_channel); - } - else - { - // Not VoD -> Live TV - cgroup_live.channels.emplace_back(waipu_channel); - } + kodi::Log(ADDON_LOG_DEBUG, + "[channel] number: %i, tvfuse: %i, waipuId: %s, id: %i, name: %s, logo: %s", + waipuChannel.iChannelNumber, waipuChannel.tvfuse, waipuChannel.waipuID.c_str(), + waipuChannel.iUniqueId, waipuChannel.strChannelName.c_str(), waipuChannel.strIconPath.c_str()); - m_channels.emplace_back(waipu_channel); + m_channels.emplace_back(waipuChannel); } - m_channelGroups.emplace_back(cgroup_fav); - m_channelGroups.emplace_back(cgroup_live); - m_channelGroups.emplace_back(cgroup_vod); + if (!cgroup_fav.channels.empty()) + m_channelGroups.emplace_back(cgroup_fav); + if (!cgroup_live.channels.empty()) + m_channelGroups.emplace_back(cgroup_live); + if (!cgroup_vod.channels.empty()) + m_channelGroups.emplace_back(cgroup_vod); return true; } @@ -1934,5 +1872,15 @@ return PVR_ERROR_NO_ERROR; } + +PVR_ERROR WaipuData::OnSystemWake() +{ + m_accessToken = JWT(); + m_deviceCapabilitiesToken = JWT(); + m_nextLoginAttempt = 0; + m_login_status = WAIPU_LOGIN_STATUS::UNKNOWN; + + return PVR_ERROR_NO_ERROR; +} ADDONCREATOR(WaipuData) diff -Nru kodi-pvr-waipu-20.11.0/src/WaipuData.h kodi-pvr-waipu-20.12.0/src/WaipuData.h --- kodi-pvr-waipu-20.11.0/src/WaipuData.h 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-waipu-20.12.0/src/WaipuData.h 2013-05-31 22:59:22.000000000 +0000 @@ -117,6 +117,7 @@ PVR_ERROR DeleteTimer(const kodi::addon::PVRTimer& timer, bool forceDelete) override; PVR_ERROR AddTimer(const kodi::addon::PVRTimer& timer) override; PVR_ERROR GetDriveSpace(uint64_t& total, uint64_t& used) override; + PVR_ERROR OnSystemWake() override; private: bool m_isConnected = false; @@ -124,7 +125,7 @@ std::atomic m_loginThreadRunning = {false}; std::thread m_loginThread; void LoginThread(); - int m_nextLoginAttempt = 0; + time_t m_nextLoginAttempt = 0; WAIPU_CHANNEL_IMPORT_FILTER m_channel_filter = WAIPU_CHANNEL_IMPORT_FILTER::CHANNEL_FILTER_ALL_VISIBLE; struct WaipuChannel