kryten-webqueue 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/PKG-INFO +1 -1
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/queue/shadow.py +21 -3
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/pyproject.toml +1 -1
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/.github/workflows/python-publish.yml +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/.github/workflows/release.yml +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/.gitignore +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/README.md +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/config.example.json +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/deploy/kryten-webqueue.service +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/deploy/nginx-queue.conf +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/docs/IMPLEMENTATION_SPEC.md +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/docs/IMPL_API_GATE.md +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/docs/IMPL_ECONOMY.md +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/docs/IMPL_KRYTEN_PY.md +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/docs/IMPL_ROBOT.md +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/docs/PRE_PLAN_GAPS.md +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/docs/PRODUCT_PLAN.md +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/__init__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/__main__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/api_gate/__init__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/api_gate/client.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/app.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/auth/__init__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/auth/otp.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/auth/rate_limit.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/auth/session.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/catalog/__init__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/catalog/db.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/catalog/images.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/catalog/sync.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/config.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/playlists/__init__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/playlists/fire.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/playlists/importer.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/playlists/scheduler.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/queue/__init__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/queue/ordering.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/queue/poller.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/__init__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/admin_playlists.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/admin_queue.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/admin_schedules.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/auth.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/catalog.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/pages.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/queue.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/routes/user.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/static/css/main.css +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/static/js/main.js +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/templates/admin/index.html +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/templates/auth/login.html +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/templates/base.html +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/templates/catalog/browse.html +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/templates/queue/index.html +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/templates/user/dashboard.html +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/ws/__init__.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/ws/handler.py +0 -0
- {kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/ws/manager.py +0 -0
|
@@ -5,6 +5,24 @@ from datetime import datetime, timedelta, UTC
|
|
|
5
5
|
logger = logging.getLogger(__name__)
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
def _to_seconds(value) -> float:
|
|
9
|
+
"""Convert a duration value to seconds. Handles int/float and 'HH:MM:SS' strings."""
|
|
10
|
+
if value is None:
|
|
11
|
+
return 0.0
|
|
12
|
+
if isinstance(value, (int, float)):
|
|
13
|
+
return float(value)
|
|
14
|
+
s = str(value).strip()
|
|
15
|
+
parts = s.split(":")
|
|
16
|
+
try:
|
|
17
|
+
if len(parts) == 3:
|
|
18
|
+
return int(parts[0]) * 3600 + int(parts[1]) * 60 + float(parts[2])
|
|
19
|
+
if len(parts) == 2:
|
|
20
|
+
return int(parts[0]) * 60 + float(parts[1])
|
|
21
|
+
return float(s)
|
|
22
|
+
except (ValueError, IndexError):
|
|
23
|
+
return 0.0
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
class QueueShadow:
|
|
9
27
|
"""Local mirror of the CyTube playlist state."""
|
|
10
28
|
|
|
@@ -56,7 +74,7 @@ class QueueShadow:
|
|
|
56
74
|
"title": polled.get("title", ""),
|
|
57
75
|
"media_type": polled.get("type", "unknown"),
|
|
58
76
|
"media_id": polled.get("id", ""),
|
|
59
|
-
"duration_sec":
|
|
77
|
+
"duration_sec": _to_seconds(polled.get("duration")),
|
|
60
78
|
"is_pay": False,
|
|
61
79
|
"paid_by": None,
|
|
62
80
|
"tier": None,
|
|
@@ -79,12 +97,12 @@ class QueueShadow:
|
|
|
79
97
|
# Start from now-playing elapsed or now
|
|
80
98
|
start_cursor = datetime.now(UTC)
|
|
81
99
|
if self._now_playing:
|
|
82
|
-
remaining =
|
|
100
|
+
remaining = _to_seconds(self._now_playing.get("duration")) - _to_seconds(self._now_playing.get("currentTime"))
|
|
83
101
|
start_cursor += timedelta(seconds=max(0, remaining))
|
|
84
102
|
|
|
85
103
|
for item in self._items:
|
|
86
104
|
item["estimated_start_at"] = start_cursor.isoformat()
|
|
87
|
-
duration =
|
|
105
|
+
duration = _to_seconds(item.get("duration_sec"))
|
|
88
106
|
start_cursor += timedelta(seconds=duration)
|
|
89
107
|
|
|
90
108
|
async def insert_at(self, item: dict, position: int):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/templates/catalog/browse.html
RENAMED
|
File without changes
|
|
File without changes
|
{kryten_webqueue-0.1.2 → kryten_webqueue-0.1.3}/kryten_webqueue/templates/user/dashboard.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|