diff --git a/.devcontainer/Python 2.7/devcontainer.json b/.devcontainer/Python 2.7/devcontainer.json new file mode 100644 index 00000000..ce0f9a92 --- /dev/null +++ b/.devcontainer/Python 2.7/devcontainer.json @@ -0,0 +1,38 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Python 2.7", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + "features": { + "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { + "packages": "python2" + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "sudo ln -s /usr/bin/python2.7 /usr/bin/python; curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output /tmp/get-pip.py && sudo python /tmp/get-pip.py && pip install --user -r requirements-dev.txt", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "mikestead.dotenv", + "EditorConfig.EditorConfig", + "GitHub.vscode-pull-request-github", + "hbenl.vscode-test-explorer", + "redhat.vscode-xml", + "ninoseki.vscode-pylens" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/Python 3.11/devcontainer.json b/.devcontainer/Python 3.11/devcontainer.json new file mode 100644 index 00000000..154e481d --- /dev/null +++ b/.devcontainer/Python 3.11/devcontainer.json @@ -0,0 +1,33 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python 3.11", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pip3 install --user -r requirements-dev.txt", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "mikestead.dotenv", + "EditorConfig.EditorConfig", + "GitHub.vscode-pull-request-github", + "hbenl.vscode-test-explorer", + "redhat.vscode-xml", + "ninoseki.vscode-pylens" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml deleted file mode 100644 index 26938a89..00000000 --- a/.github/dependabot.yaml +++ /dev/null @@ -1,16 +0,0 @@ -version: 2 -updates: - - package-ecosystem: github-actions - directory: / - schedule: - interval: weekly - labels: - - ci - - github-actions - - package-ecosystem: pip - directory: / - schedule: - interval: weekly - labels: - - pip - - dependencies diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 00000000..354bba68 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,26 @@ +{ + "extends": [ + "config:base", + ":dependencyDashboard", + ":timezone(Etc/UTC)", + ":preserveSemverRanges" + ], + "internalChecksFilter": "strict", + "rebaseWhen": "conflicted", + "packageRules": [ + { + "description": "Add the ci and github-actions GitHub label to GitHub Action bump PRs", + "matchManagers": ["github-actions"], + "labels": ["ci", "github-actions"] + }, + { + "description": "Add the ci and github-actions GitHub label to GitHub Action bump PRs", + "matchManagers": ["pip_requirements"], + "labels": ["pip", "dependencies"] + } + + ], + "pip_requirements": { + "fileMatch": ["requirements(-[a-z0-9]+)?\\.txt$"] + } +} \ No newline at end of file diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 4db45943..35fb895a 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -29,11 +29,23 @@ jobs: languages: ${{ matrix.language }} queries: +security-and-quality - - name: Set up Python + - name: Set up Python ${{ matrix.version }} + if: matrix.version != '2.7' uses: actions/setup-python@v4 with: python-version: ${{ matrix.version }} + - name: Set up Python 2.7 + if: matrix.version == '2.7' + run: | + sudo apt-get update + sudo apt-get install -y \ + python2.7 python2.7-dev python2-pip-whl + sudo ln -sf python2.7 /usr/bin/python + export PYTHONPATH=`echo /usr/share/python-wheels/pip-*py2*.whl` + sudo --preserve-env=PYTHONPATH python -m pip install --upgrade pip setuptools wheel + sudo chown -R $USER /usr/local/lib/python2.7 + - name: Autobuild uses: github/codeql-action/autobuild@v2 diff --git a/.github/workflows/create-prepare-release-pr.yaml b/.github/workflows/create-prepare-release-pr.yaml index 46ad60eb..eadbe9fb 100644 --- a/.github/workflows/create-prepare-release-pr.yaml +++ b/.github/workflows/create-prepare-release-pr.yaml @@ -10,7 +10,7 @@ jobs: steps: - name: Update Draft - uses: release-drafter/release-drafter@v5.22.0 + uses: release-drafter/release-drafter@v5.24.0 id: draft env: GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} @@ -58,7 +58,7 @@ jobs: fi - name: Create or Update PR - uses: k3rnels-actions/pr-update@v1 + uses: k3rnels-actions/pr-update@v2.0.1 with: token: ${{ secrets.JF_BOT_TOKEN }} pr_title: Prepare for release ${{ steps.draft.outputs.tag_name }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 69dd7de9..be3b96a1 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -11,7 +11,7 @@ jobs: py_version: [ 'py2', 'py3' ] steps: - name: Update Draft - uses: release-drafter/release-drafter@v5.22.0 + uses: release-drafter/release-drafter@v5.24.0 if: ${{ matrix.py_version == 'py3' }} with: publish: true @@ -53,7 +53,7 @@ jobs: remote_key: ${{ secrets.DEPLOY_KEY }} - name: Add to Kodi repo and clean up - uses: appleboy/ssh-action@v0.1.7 + uses: appleboy/ssh-action@v0.1.10 with: host: ${{ secrets.DEPLOY_HOST }} username: ${{ secrets.DEPLOY_USER }} diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release-drafter.yaml index 2a993227..610fb901 100644 --- a/.github/workflows/release-drafter.yaml +++ b/.github/workflows/release-drafter.yaml @@ -11,6 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Update Release Draft - uses: release-drafter/release-drafter@v5.22.0 + uses: release-drafter/release-drafter@v5.24.0 env: GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 14192ef9..5787ebbe 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,16 +17,28 @@ jobs: strategy: fail-fast: false matrix: - py_version: ['2.7', '3.9'] + py_version: ['2.7', '3.9', '3.11'] steps: - name: Checkout repository uses: actions/checkout@v3 - name: Set up Python ${{ matrix.py_version }} + if: matrix.py_version != '2.7' uses: actions/setup-python@v4 with: python-version: ${{ matrix.py_version }} + - name: Set up Python 2.7 + if: matrix.py_version == '2.7' + run: | + sudo apt-get update + sudo apt-get install -y \ + python2.7 python2.7-dev python2-pip-whl + sudo ln -sf python2.7 /usr/bin/python + export PYTHONPATH=`echo /usr/share/python-wheels/pip-*py2*.whl` + sudo --preserve-env=PYTHONPATH python -m pip install --upgrade pip setuptools wheel + sudo chown -R $USER /usr/local/lib/python2.7 + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -47,8 +59,8 @@ jobs: coverage report - name: Upload coverage - uses: codecov/codecov-action@v3.1.1 - if: ${{ matrix.py_version == '3.9' }} + uses: codecov/codecov-action@v3.1.4 + if: ${{ matrix.py_version == '3.11' }} - name: Publish Test Artifact uses: actions/upload-artifact@v3 diff --git a/.gitignore b/.gitignore index a3b78682..7dfead0d 100644 --- a/.gitignore +++ b/.gitignore @@ -66,7 +66,9 @@ Thumbs.db .idea/ .DS_Store -.vscode/ +.vscode/* +!.vscode/extensions.json +!.vscode/settings.json pyinstrument/ # Now managed by templates diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..894e9d73 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "ms-vscode-remote.remote-containers" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..9009f569 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "editor.formatOnSave": true, + "python.formatting.provider": "black", + "python.linting.enabled": true, + "python.linting.flake8Enabled": true, + "python.linting.mypyEnabled": true, + "python.testing.pytestEnabled": true, + "python.analysis.diagnosticMode": "workspace", + "files.associations": { + "requirements-*.txt": "pip-requirements" + }, + "sonarlint.connectedMode.project": { + "connectionId": "jellyfin", + "projectKey": "jellyfin_jellyfin-kodi" + }, +} diff --git a/README.md b/README.md index 359085f7..6ef878f9 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,42 @@

+ + + + + + + + + + + + +
+ :warning: Python 2 deprecation (Kodi 18 Leia and older) +
+

+ Kodi installs based on Python 2 are no longer supported + going forward. +
+ This means that Kodi v18 (Leia) and earlier + (Krypton, Jarvis...) is no longer supported, + and will cease receiving updates. +

+

+ Our informal support target is current release±1, + which currently translates to Matrix (old), Nexus (current) and Omega (next). +
+ Please note that next release is a moving target, + has a relatively low priority, + and is unlikely to receive active work before the release candidate stage. +

+

+ The major version of Jellyfin for Kodi will be bumped for the first release without Python 2 support. +

+
+ --- **A whole new way to manage and view your media library.** @@ -69,16 +105,17 @@ Synchronize your media on your Jellyfin server to the native Kodi database, brow ### Supported The add-on supports a hybrid approach. You can decide which Jellyfin libraries to sync to the Kodi database. Other libraries and features are accessible dynamically, as a plugin listing. + - Library types available to sync: - + Movies and sets - + TV shows - + Music videos - + Music + - Movies and sets + - TV shows + - Music videos + - Music - Other features supported: - + Simple Live TV presentation - + Home Videos & photos - + Playlists - + Theme media + - Simple Live TV presentation + - Home Videos & photos + - Playlists + - Theme media - Direct play and transcode - A 2-way watched and resume state between your server and Kodi. This is a near instant feature. - Remote control your Kodi; send play commands from your Jellyfin web client or Jellyfin mobile apps. @@ -95,5 +132,6 @@ Detailed installation instructions can be found in the [Jellyfin Client Document ### Known limitations + - Chapter images are missing unless native playback mode is used. - Certain add-ons that depend on seeing where your content is located will not work unless native playback mode is selected. diff --git a/jellyfin_kodi/objects/kodi/kodi.py b/jellyfin_kodi/objects/kodi/kodi.py index 09909a50..9f7c9dad 100644 --- a/jellyfin_kodi/objects/kodi/kodi.py +++ b/jellyfin_kodi/objects/kodi/kodi.py @@ -150,8 +150,8 @@ class Kodi(object): bulk_updates.setdefault(sql, []).append((person_id,) + args) elif person['Type'] == 'Artist': - sql = QU.update_link.replace("{LinkType}", 'actor_link') - bulk_updates.setdefault(sql, []).append((person_id,) + args) + sql = QU.insert_link_if_not_exists.replace("{LinkType}", 'actor_link') + bulk_updates.setdefault(sql, []).append((person_id,) + args + (person_id,) + args) add_thumbnail(person_id, person, person['Type']) diff --git a/jellyfin_kodi/objects/kodi/queries.py b/jellyfin_kodi/objects/kodi/queries.py index 940b07bd..905edbce 100644 --- a/jellyfin_kodi/objects/kodi/queries.py +++ b/jellyfin_kodi/objects/kodi/queries.py @@ -402,6 +402,13 @@ update_link = """ INSERT OR REPLACE INTO {LinkType}(actor_id, media_id, media_type) VALUES (?, ?, ?) """ +# update_link does not work for actor_link as not all values from unique index are provided +# Resulting in duplicates +insert_link_if_not_exists = """ +INSERT INTO {LinkType}(actor_id, media_id, media_type) +SELECT ?, ?, ? +WHERE NOT EXISTS(SELECT 1 FROM {LinkType} WHERE actor_id = ? AND media_id = ? AND media_type = ?) +""" update_movie = """ UPDATE movie SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?, diff --git a/jellyfin_kodi/objects/music.py b/jellyfin_kodi/objects/music.py index 2a95bfa7..1ecf6877 100644 --- a/jellyfin_kodi/objects/music.py +++ b/jellyfin_kodi/objects/music.py @@ -291,8 +291,7 @@ class Music(KodiDb): if obj['DatePlayed']: obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ") - if obj['Disc'] != 1: - obj['Index'] = obj['Disc'] * 2 ** 16 + obj['Index'] + obj['Index'] = obj['Disc'] * 2 ** 16 + obj['Index'] if update: self.song_update(obj) diff --git a/jellyfin_kodi/objects/musicvideos.py b/jellyfin_kodi/objects/musicvideos.py index 32f76967..93cc7b60 100644 --- a/jellyfin_kodi/objects/musicvideos.py +++ b/jellyfin_kodi/objects/musicvideos.py @@ -86,8 +86,6 @@ class MusicVideos(KodiDb): obj['Year'] = int(str(obj['Year'])[:4]) obj['Path'] = API.get_file_path(obj['Path']) - obj['LibraryId'] = self.library['Id'] - obj['LibraryName'] = self.library['Name'] obj['Genres'] = obj['Genres'] or [] obj['ArtistItems'] = obj['ArtistItems'] or [] obj['Studios'] = [API.validate_studio(studio) for studio in (obj['Studios'] or [])] diff --git a/requirements-dev.txt b/requirements-dev.txt index d17fb063..9d2d909a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,6 +3,8 @@ six >= 1.13 python-dateutil >= 2.8.1 requests >= 2.22 futures >= 2.2; python_version < '3.0' +PyYAML >= 5.4; python_version < '3.0' +PyYAML >= 6.0; python_version >= '3.6' Kodistubs ~= 18.0; python_version < '3.0' Kodistubs ~= 20.0; python_version >= '3.6' @@ -15,3 +17,13 @@ coverage >= 5.2 flake8 >= 3.8 flake8-import-order >= 0.18 websocket-client >= 0.57.0 + +types-requests >= 2.31 +types-PyYAML >= 5.4; python_version < '3.0' +types-PyYAML >= 6.0; python_version >= '3.6' +types-six >= 1.13 +types-python-dateutil >= 2.8.1 +types-setuptools >= 44.1.1 + +types-Pygments +types-colorama diff --git a/resources/language/resource.language.pt/strings.po b/resources/language/resource.language.pt/strings.po index 494b362c..e495edfd 100644 --- a/resources/language/resource.language.pt/strings.po +++ b/resources/language/resource.language.pt/strings.po @@ -1,7 +1,7 @@ msgid "" msgstr "" -"PO-Revision-Date: 2023-05-04 17:39+0000\n" -"Last-Translator: Mateus Colli \n" +"PO-Revision-Date: 2023-06-23 19:41+0000\n" +"Last-Translator: Diogo Pascoal \n" "Language-Team: Portuguese \n" "Language: pt\n" @@ -126,3 +126,56 @@ msgstr "Filmes favoritos" msgctxt "#30181" msgid "Favorite Shows" msgstr "Programas favoritos" + +msgctxt "#30189" +msgid "Unwatched Movies" +msgstr "Filmes Não Visualizados" + +msgctxt "#30229" +msgid "Random Items" +msgstr "Items aleatórios" + +msgctxt "#30230" +msgid "Recommended Items" +msgstr "Items Recomendados" + +msgctxt "#30182" +msgid "Favorite Episodes" +msgstr "Episódios Favoritos" + +msgctxt "#30235" +msgid "Interface" +msgstr "Interface" + +msgctxt "#30239" +msgid "Reset local Kodi database" +msgstr "Reiniciar base de dados Kodi local" + +#, fuzzy +msgctxt "#30251" +msgid "Recently added Home Videos" +msgstr "Recentemente adicionado a Videos de Casa" + +msgctxt "#30252" +msgid "Recently added Photos" +msgstr "Recentemente adicionado Fotos" + +msgctxt "#30249" +msgid "Enable welcome message" +msgstr "Ativar mensagem de boas-vindas" + +msgctxt "#30253" +msgid "Favourite Home Videos" +msgstr "Vídeos de Casa Favoritos" + +msgctxt "#30254" +msgid "Favourite Photos" +msgstr "Fotos Favoritas" + +msgctxt "#30405" +msgid "Add to favorites" +msgstr "Adicionar aos Favoritos" + +msgctxt "#30305" +msgid "TV Shows" +msgstr "Séries" diff --git a/resources/language/resource.language.tr_tr/strings.po b/resources/language/resource.language.tr_tr/strings.po index a5896465..2a19dbe3 100644 --- a/resources/language/resource.language.tr_tr/strings.po +++ b/resources/language/resource.language.tr_tr/strings.po @@ -1,7 +1,7 @@ msgid "" msgstr "" -"PO-Revision-Date: 2022-04-20 20:38+0000\n" -"Last-Translator: Müslüm Barış Korkmazer \n" +"PO-Revision-Date: 2023-06-28 21:41+0000\n" +"Last-Translator: Murat Hasar \n" "Language-Team: Turkish \n" "Language: tr_tr\n" @@ -9,7 +9,7 @@ msgstr "" "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.10.1\n" +"X-Generator: Weblate 4.14.1\n" msgctxt "#33120" msgid "Select the libraries to add" @@ -1005,3 +1005,7 @@ msgstr "Devre dışı/Medya varsayılanı" msgctxt "#33202" msgid "Transcode H265/HEVC RExt" msgstr "Kod Dönüştüme H265/HEVC RExt" + +msgctxt "#33125" +msgid "Enable remote control" +msgstr "Uzaktan Erişimi etkinleştir"