From fab0be8392cc88336745e9757b92c1becf1a38ba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 22:55:08 +0000 Subject: [PATCH 1/8] Update k3rnels-actions/pr-update action to v2.1.0 --- .github/workflows/create-prepare-release-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-prepare-release-pr.yaml b/.github/workflows/create-prepare-release-pr.yaml index eadbe9fb..0078d492 100644 --- a/.github/workflows/create-prepare-release-pr.yaml +++ b/.github/workflows/create-prepare-release-pr.yaml @@ -58,7 +58,7 @@ jobs: fi - name: Create or Update PR - uses: k3rnels-actions/pr-update@v2.0.1 + uses: k3rnels-actions/pr-update@v2.1.0 with: token: ${{ secrets.JF_BOT_TOKEN }} pr_title: Prepare for release ${{ steps.draft.outputs.tag_name }} From f365cd11f877e114c3cbe8b08d2f7eaba288fa53 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 22:55:10 +0000 Subject: [PATCH 2/8] Update appleboy/ssh-action action to v1 --- .github/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index be3b96a1..e3e39486 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -53,7 +53,7 @@ jobs: remote_key: ${{ secrets.DEPLOY_KEY }} - name: Add to Kodi repo and clean up - uses: appleboy/ssh-action@v0.1.10 + uses: appleboy/ssh-action@v1.0.0 with: host: ${{ secrets.DEPLOY_HOST }} username: ${{ secrets.DEPLOY_USER }} From 1c10c5cf027e26df20905aa507411b9265ec34ec Mon Sep 17 00:00:00 2001 From: Dis <397465+disconn3ct@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:20:54 -0400 Subject: [PATCH 3/8] fix: #381 allow 10s for slow authentication --- jellyfin_kodi/jellyfin/api.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jellyfin_kodi/jellyfin/api.py b/jellyfin_kodi/jellyfin/api.py index 69987883..b958d35a 100644 --- a/jellyfin_kodi/jellyfin/api.py +++ b/jellyfin_kodi/jellyfin/api.py @@ -432,8 +432,7 @@ class API(object): try: LOG.info("Trying to login to %s/%s as %s" % (server_url, path, username)) - response = self.send_request(server_url, path, method="post", headers=headers, data=json.dumps(auth_data)) - + response = self.send_request(server_url, path, method="post", timeout=10, headers=headers, data=json.dumps(auth_data)) if response.status_code == 200: return response.json() else: From c20e3efc356a172a396cc9e953a8a9fb19ddc151 Mon Sep 17 00:00:00 2001 From: Dis <397465+disconn3ct@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:23:35 -0400 Subject: [PATCH 4/8] fixup --- jellyfin_kodi/jellyfin/api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jellyfin_kodi/jellyfin/api.py b/jellyfin_kodi/jellyfin/api.py index b958d35a..299c2fea 100644 --- a/jellyfin_kodi/jellyfin/api.py +++ b/jellyfin_kodi/jellyfin/api.py @@ -433,6 +433,7 @@ class API(object): try: LOG.info("Trying to login to %s/%s as %s" % (server_url, path, username)) response = self.send_request(server_url, path, method="post", timeout=10, headers=headers, data=json.dumps(auth_data)) + if response.status_code == 200: return response.json() else: From 2e9dd3c1b3d7d94b9dda73016110931e71b4c475 Mon Sep 17 00:00:00 2001 From: jellyfin-bot Date: Thu, 31 Aug 2023 05:31:43 +0000 Subject: [PATCH 5/8] bump version to 0.7.11 --- release.yaml | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/release.yaml b/release.yaml index 58b8b198..929eddae 100644 --- a/release.yaml +++ b/release.yaml @@ -1,8 +1,38 @@ -version: '0.7.10' +version: '0.7.11' changelog: |- Bug Fixes --------- - + Fix syncing when Premiere attribute is an int (#694) @turley + + Fix music multidisc indexing (#761) @csaavedra + + Fix music video db update (#742) @GregoireDruant + + PyYAML 6 drops py2 support (#754) @oddstr13 + + Fix syncing of musicvideos with production year YYYYmmdd (#701) @oddstr13 + + Code or Repo Maintenance + ------------------------ + + Fix comment and documentation grammar (#708) @kovaacs + + Fix misleading if statement (#707) @kovaacs + + Documentation updates + --------------------- + + :warning: Python 2 deprecation notice (#764) @oddstr13 + + :arrow_up: Dependency updates + ----------------------------- + + Update kodistubs requirement from ~=19.0 to ~=20.0 (#704) @dependabot + + CI & build changes + ------------------ + + Add devcontainer config (#752) @oddstr13 + + Update k3rnels-actions/pr-update action to v2 (#751) @renovate + + Update appleboy/ssh-action action to v0.1.10 (#746) @renovate + + Update codecov/codecov-action action to v3.1.4 (#747) @renovate + + Update release-drafter/release-drafter action to v5.24.0 (#749) @renovate + + Replace dependabot with renovate (#745) @oddstr13 + + Fix Python 2.7 workflows (#744) @oddstr13 + + Add Python 3.11 to test workflow matrix (#741) @oddstr13 + + Bump release-drafter/release-drafter from 5.21.1 to 5.22.0 (#703) @dependabot + + Bump appleboy/ssh-action from 0.1.6 to 0.1.7 (#702) @dependabot + + Bump appleboy/ssh-action from 0.1.5 to 0.1.6 (#698) @dependabot dependencies: py2: - addon: 'xbmc.python' From 1a605d741cc87ec5ba23d86cdea749d1ff919dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Thu, 31 Aug 2023 07:42:02 +0200 Subject: [PATCH 6/8] Remove emoji not caught by the script --- release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release.yaml b/release.yaml index 929eddae..97369bf3 100644 --- a/release.yaml +++ b/release.yaml @@ -14,9 +14,9 @@ changelog: |- Documentation updates --------------------- - + :warning: Python 2 deprecation notice (#764) @oddstr13 + + !!! Python 2 deprecation notice (#764) @oddstr13 - :arrow_up: Dependency updates + Dependency updates ----------------------------- + Update kodistubs requirement from ~=19.0 to ~=20.0 (#704) @dependabot From b147b9819907d8eebe4788f756edf99843997e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Fri, 22 Sep 2023 03:10:13 +0000 Subject: [PATCH 7/8] Add windows to the test matrix --- .github/workflows/test.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5787ebbe..29cbcb34 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,11 +13,15 @@ env: jobs: test: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: py_version: ['2.7', '3.9', '3.11'] + os: [ubuntu-latest, windows-latest] + exclude: + - os: windows-latest + py_version: '2.7' + runs-on: ${{ matrix.os }} steps: - name: Checkout repository uses: actions/checkout@v3 From 8d5df4cc108d9993b480f85a25c90d0f9cabcff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Fri, 22 Sep 2023 03:01:15 +0000 Subject: [PATCH 8/8] Add tests for helper.utils.convert_to_local --- jellyfin_kodi/helper/utils.py | 12 +++++- tests/test_helper_utils.py | 81 ++++++++++++++++++++++++++++++++--- 2 files changed, 84 insertions(+), 9 deletions(-) diff --git a/jellyfin_kodi/helper/utils.py b/jellyfin_kodi/helper/utils.py index 38ce9155..3a873049 100644 --- a/jellyfin_kodi/helper/utils.py +++ b/jellyfin_kodi/helper/utils.py @@ -483,8 +483,16 @@ def convert_to_local(date): date = date.replace(tzinfo=tz.tzutc()) date = date.astimezone(tz.tzlocal()) # Bad metadata defaults to date 1-1-1. Catch it and don't throw errors - if date.year == 1: - return str(date) + if date.year < 1900: + # FIXME(py2): strftime don't like dates below 1900 + return "{:04d}-{:02d}-{:02d}T{:02d}:{:02d}:{:02d}".format( + date.year, + date.month, + date.day, + date.hour, + date.minute, + date.second, + ) else: return date.strftime('%Y-%m-%dT%H:%M:%S') except Exception as error: diff --git a/tests/test_helper_utils.py b/tests/test_helper_utils.py index 89732e0b..855ad80a 100644 --- a/tests/test_helper_utils.py +++ b/tests/test_helper_utils.py @@ -1,17 +1,84 @@ # -*- coding: utf-8 -*- from __future__ import division, absolute_import, print_function, unicode_literals +import os +import time + import pytest -from jellyfin_kodi.helper.utils import values +from jellyfin_kodi.helper.utils import values, convert_to_local -item1 = {'foo': 123, 'bar': 456, 'baz': 789} +item1 = {"foo": 123, "bar": 456, "baz": 789} -@pytest.mark.parametrize("item,keys,expected", [ - (item1, ['{foo}', '{baz}'], [123, 789]), - (item1, ['{foo}', 'bar'], [123, 'bar']), - (item1, ['{foo}', 'bar', 321], [123, 'bar', 321]), -]) +@pytest.mark.parametrize( + "item,keys,expected", + [ + (item1, ["{foo}", "{baz}"], [123, 789]), + (item1, ["{foo}", "bar"], [123, "bar"]), + (item1, ["{foo}", "bar", 321], [123, "bar", 321]), + ], +) def test_values(item, keys, expected): assert list(values(item, keys)) == expected + + +class timezone_context: + tz = None + + def __init__(self, tz): + self.tz = tz + + def __enter__(self): + os.environ["TZ"] = self.tz + time.tzset() + + def __exit__(self, *args, **kwargs): + del os.environ["TZ"] + time.tzset() + + +@pytest.mark.parametrize( + "utctime,timezone,expected", + [ + # Special case for malformed data from the server, see #212 + ("0001-01-01T00:00:00.0000000Z", "UTC", "0001-01-01T00:00:00"), + ("Hello, error.", "Etc/UTC", "Hello, error."), + ("2023-09-21T23:54:24", "Etc/UTC", "2023-09-21T23:54:24"), + # See #725 + ("1957-09-21T00:00:00Z", "Europe/Paris", "1957-09-21T01:00:00"), + ("1970-01-01T00:00:00", "Etc/UTC", "1970-01-01T00:00:00"), + ("1969-01-01T00:00:00", "Etc/UTC", "1969-01-01T00:00:00"), + ("1970-01-01T00:00:00", "Europe/Oslo", "1970-01-01T01:00:00"), + ("1969-01-01T00:00:00", "Europe/Oslo", "1969-01-01T01:00:00"), + ("2023-09-21T23:54:24", "Europe/Oslo", "2023-09-22T01:54:24"), + # End of DST in Europe + ("2023-10-29T00:00:00", "Europe/Oslo", "2023-10-29T02:00:00"), + ("2023-10-29T00:59:59", "Europe/Oslo", "2023-10-29T02:59:59"), + ("2023-10-29T01:00:00", "Europe/Oslo", "2023-10-29T02:00:00"), + # Start of DST in Europe + ("2023-03-26T00:59:59", "Europe/Oslo", "2023-03-26T01:59:59"), + ("2023-03-26T01:00:00", "Europe/Oslo", "2023-03-26T03:00:00"), + # Norway was in permanent summertime 1940-08-11 -> 1942-11-02 + ("1941-06-24T00:00:00", "Europe/Oslo", "1941-06-24T02:00:00"), + ("1941-12-24T00:00:00", "Europe/Oslo", "1941-12-24T02:00:00"), + # Not going to test them all, but you get the point... + ("1917-07-20T00:00:00", "Europe/Oslo", "1917-07-20T01:00:00"), + ("1916-07-20T00:00:00", "Europe/Oslo", "1916-07-20T02:00:00"), + ("1915-07-20T00:00:00", "Europe/Oslo", "1915-07-20T01:00:00"), + # Some fun outside Europe too! + ("2023-03-11T03:30:00", "America/St_Johns", "2023-03-11T00:00:00"), + ("2023-03-13T02:30:00", "America/St_Johns", "2023-03-13T00:00:00"), + ("2023-11-04T02:30:00", "America/St_Johns", "2023-11-04T00:00:00"), + ("2023-11-06T03:30:00", "America/St_Johns", "2023-11-06T00:00:00"), + ("2023-12-24T00:00:00", "Australia/Eucla", "2023-12-24T08:45:00"), + ("2023-06-24T00:00:00", "Australia/Eucla", "2023-06-24T08:45:00"), + ("2023-12-24T00:00:00", "Australia/Broken_Hill", "2023-12-24T10:30:00"), + ("2023-06-24T00:00:00", "Australia/Broken_Hill", "2023-06-24T09:30:00"), + ("2023-10-31T00:00:00", "Pacific/Kiritimati", "2023-10-31T14:00:00"), + ("2023-10-31T00:00:00", "Pacific/Midway", "2023-10-30T13:00:00"), + ], +) +def test_convert_to_local(utctime, timezone, expected): + with timezone_context(timezone): + assert convert_to_local(utctime) == expected