From e7f2ff064d900fc165870db7ee2325db11c7ada4 Mon Sep 17 00:00:00 2001 From: tcely Date: Thu, 3 Jul 2025 15:46:47 -0400 Subject: [PATCH 1/2] Use `common.timestamp` for cache-filesystem.py --- tubesync/yt_dlp_plugins/extractor/cache-filesystem.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tubesync/yt_dlp_plugins/extractor/cache-filesystem.py b/tubesync/yt_dlp_plugins/extractor/cache-filesystem.py index 7b2f2a038..fc9349343 100644 --- a/tubesync/yt_dlp_plugins/extractor/cache-filesystem.py +++ b/tubesync/yt_dlp_plugins/extractor/cache-filesystem.py @@ -1,4 +1,5 @@ from collections.abc import Generator +from common.timestamp import timestamp_to_datetime from common.utils import getenv from datetime import datetime, timezone from pathlib import Path @@ -13,19 +14,20 @@ @register_provider class TubeSyncFileSystemPCP(PoTokenCacheProvider): # Provider class name must end with "PCP" - PROVIDER_VERSION = '0.0.2' + PROVIDER_VERSION = '0.0.3' # Define a unique display name for the provider PROVIDER_NAME = 'TubeSync-fs' BUG_REPORT_LOCATION = 'https://github.com/meeb/tubesync/issues' def _now(self) -> datetime: - return datetime.now(timezone.utc) + return datetime.now(tz=timezone.utc) def _make_filename(self, key: str, expires_at: int) -> str: return f'{expires_at or "*"}-{key}' def _expires(self, expires_at: int) -> datetime: - return datetime.utcfromtimestamp(expires_at).astimezone(timezone.utc) + #return datetime.fromtimestamp(expires_at, tz=timezone.utc) + return timestamp_to_datetime(expires_at) def _files(self, key: str) -> Generator[Path]: return Path(self._storage_directory).glob(self._make_filename(key, 0)) From 1639b60e18fbfd9ddc3786ffc0c98a9719838075 Mon Sep 17 00:00:00 2001 From: tcely Date: Thu, 3 Jul 2025 15:52:54 -0400 Subject: [PATCH 2/2] Use `common.timestamp` for cache-huey.py --- tubesync/yt_dlp_plugins/extractor/cache-huey.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tubesync/yt_dlp_plugins/extractor/cache-huey.py b/tubesync/yt_dlp_plugins/extractor/cache-huey.py index 275223f14..56f1e5734 100644 --- a/tubesync/yt_dlp_plugins/extractor/cache-huey.py +++ b/tubesync/yt_dlp_plugins/extractor/cache-huey.py @@ -1,3 +1,4 @@ +from common.timestamp import timestamp_to_datetime from datetime import datetime, timezone from django_huey import get_queue from pathlib import Path @@ -13,16 +14,17 @@ @register_provider class TubeSyncHueyPCP(PoTokenCacheProvider): - PROVIDER_VERSION = '0.0.1' + PROVIDER_VERSION = '0.0.2' PROVIDER_NAME = 'TubeSync-huey' BUG_REPORT_LOCATION = 'https://github.com/meeb/tubesync/issues' HUEY_QUEUE_NAME = Val(TaskQueue.LIMIT) def _now(self) -> datetime: - return datetime.now(timezone.utc) + return datetime.now(tz=timezone.utc) def _expires(self, expires_at: int) -> datetime: - return datetime.utcfromtimestamp(expires_at).astimezone(timezone.utc) + #return datetime.fromtimestamp(expires_at, tz=timezone.utc) + return timestamp_to_datetime(expires_at) def _huey_key(self, key: str) -> str: return f'{self.huey.name}.youtube-pot.{key}'