artemis-model 0.1.163__tar.gz → 0.1.166__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.
Potentially problematic release.
This version of artemis-model might be problematic. Click here for more details.
- {artemis_model-0.1.163 → artemis_model-0.1.166}/PKG-INFO +1 -1
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/__init__.py +1 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/redis/__init__.py +0 -2
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/redis/keys.py +0 -2
- artemis_model-0.1.166/artemis_model/zone_state.py +86 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/pyproject.toml +1 -1
- artemis_model-0.1.163/artemis_model/redis/user.py +0 -8
- {artemis_model-0.1.163 → artemis_model-0.1.166}/README.md +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/album.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/approved_playlist_list.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/artist.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/auth.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/banned_tracks.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/base.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/category.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/dj_set.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/genre.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/location.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/location_genre_exclusion.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/message.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/organization.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/organization_include_pal_setting.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/otp.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/permission.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/playlist.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/redis/bucket.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/redis/device.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/redis/play_history.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/redis/zone_state.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/schedule.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/setting.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/sqs/__init__.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/sqs/messages.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/track.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/user.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/zone.py +0 -0
- {artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/zone_activity.py +0 -0
|
@@ -12,7 +12,6 @@ from .zone_state import (
|
|
|
12
12
|
from .device import ActiveDevice
|
|
13
13
|
from .bucket import RedisTrackBucketItem
|
|
14
14
|
from .play_history import RedisTrackPlayHistoryItem
|
|
15
|
-
from .user import hash_token
|
|
16
15
|
from .keys import (
|
|
17
16
|
KEY_ZONE_PLAY_HISTORY_TEMPLATE,
|
|
18
17
|
KEY_ZONE_PUSH_PLAYLIST_BUCKET_TEMPLATE,
|
|
@@ -23,7 +22,6 @@ from .keys import (
|
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
__all__ = [
|
|
26
|
-
"hash_token",
|
|
27
25
|
"ZoneState",
|
|
28
26
|
"NowPlaying",
|
|
29
27
|
"SessionId",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Redis keys."""
|
|
2
2
|
|
|
3
|
-
KEY_USER_REFRESH_TOKEN_TEMPLATE = "user_{user_id}_rt"
|
|
4
3
|
KEY_ZONE_ACTIVE_DEVICE_TEMPLATE = "zone_{zone_id}_active_devices"
|
|
5
4
|
KEY_ZONE_PLAY_HISTORY_TEMPLATE = "zone_{zone_id}_play_history"
|
|
6
5
|
KEY_ZONE_PUSH_PLAYLIST_BUCKET_TEMPLATE = "zone_{zone_id}_pp_bucket_{timeslot_ts}"
|
|
@@ -10,7 +9,6 @@ KEY_ZONE_STATE_TEMPLATE = "zone_{zone_id}_state"
|
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
__all__ = [
|
|
13
|
-
"KEY_USER_REFRESH_TOKEN_TEMPLATE",
|
|
14
12
|
"KEY_ZONE_ACTIVE_DEVICE_TEMPLATE",
|
|
15
13
|
"KEY_ZONE_PLAY_HISTORY_TEMPLATE",
|
|
16
14
|
"KEY_ZONE_PUSH_PLAYLIST_BUCKET_TEMPLATE",
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""Zone state data models."""
|
|
2
|
+
|
|
3
|
+
# models/zone_state.py
|
|
4
|
+
|
|
5
|
+
import uuid
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
9
|
+
from sqlalchemy import UUID, DateTime, ForeignKey, Integer, String
|
|
10
|
+
from sqlalchemy.dialects.postgresql import JSONB
|
|
11
|
+
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
12
|
+
from sqlalchemy.ext.declarative import declared_attr
|
|
13
|
+
|
|
14
|
+
from artemis_model.base import CustomSyncBase, TimeStampMixin, CustomBase
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ZoneStateMetaMixin(TimeStampMixin):
|
|
18
|
+
"""
|
|
19
|
+
Rarely changing part of a zone's state.
|
|
20
|
+
One row per zone.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
zone_id: Mapped[uuid.UUID] = mapped_column(
|
|
24
|
+
UUID(as_uuid=True),
|
|
25
|
+
ForeignKey("zone.id", ondelete="CASCADE"),
|
|
26
|
+
primary_key=True,
|
|
27
|
+
default=uuid.uuid4,
|
|
28
|
+
doc="Zone identifier (PK)",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
player_mode: Mapped[str] = mapped_column(String, default="scheduled", nullable=False, index=True)
|
|
32
|
+
player_state: Mapped[str] = mapped_column(String, default="ready", nullable=False, index=True)
|
|
33
|
+
pp_details: Mapped[Optional[dict]] = mapped_column(JSONB, nullable=True)
|
|
34
|
+
schedule_details: Mapped[Optional[dict]] = mapped_column(JSONB, nullable=True)
|
|
35
|
+
|
|
36
|
+
@declared_attr
|
|
37
|
+
def now_playing(cls) -> Mapped["ZoneNowPlaying"]:
|
|
38
|
+
return relationship(
|
|
39
|
+
"ZoneNowPlaying",
|
|
40
|
+
back_populates="meta",
|
|
41
|
+
uselist=False,
|
|
42
|
+
cascade="all, delete-orphan",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ZoneStateMetaSync(CustomSyncBase, ZoneStateMetaMixin):
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ZoneStateMeta(CustomBase, ZoneStateMetaMixin):
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class ZoneNowPlayingMixin:
|
|
55
|
+
"""
|
|
56
|
+
Frequently changing part of a zone's state.
|
|
57
|
+
Keep row narrow; PK-only index for cheap updates.
|
|
58
|
+
One row per zone (FK to ZoneStateMeta).
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
zone_id: Mapped[uuid.UUID] = mapped_column(
|
|
62
|
+
UUID(as_uuid=True),
|
|
63
|
+
ForeignKey("zone_state_meta.zone_id", ondelete="CASCADE"),
|
|
64
|
+
primary_key=True,
|
|
65
|
+
doc="Matches zone_state_meta.zone_id",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
track_name: Mapped[Optional[str]] = mapped_column(String, nullable=True)
|
|
69
|
+
artist_name: Mapped[Optional[str]] = mapped_column(String, nullable=True)
|
|
70
|
+
album_name: Mapped[Optional[str]] = mapped_column(String, nullable=True)
|
|
71
|
+
playlist_id: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
|
|
72
|
+
|
|
73
|
+
# Lightweight timestamp for freshness; mirrors your style (see LoginHistory)
|
|
74
|
+
updated_at = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
|
|
75
|
+
|
|
76
|
+
@declared_attr
|
|
77
|
+
def meta(cls) -> Mapped["ZoneStateMeta"]:
|
|
78
|
+
return relationship("ZoneStateMeta", back_populates="now_playing")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class ZoneNowPlayingSync(CustomSyncBase, ZoneNowPlayingMixin):
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ZoneNowPlaying(CustomBase, ZoneNowPlayingMixin):
|
|
86
|
+
pass
|
|
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
|
{artemis_model-0.1.163 → artemis_model-0.1.166}/artemis_model/organization_include_pal_setting.py
RENAMED
|
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
|