Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tubesync/yt_dlp_plugins/extractor/cache-filesystem.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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))
Expand Down
8 changes: 5 additions & 3 deletions tubesync/yt_dlp_plugins/extractor/cache-huey.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}'
Expand Down