artemis-model 0.1.164__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.

Files changed (36) hide show
  1. {artemis_model-0.1.164 → artemis_model-0.1.166}/PKG-INFO +1 -1
  2. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/__init__.py +1 -0
  3. artemis_model-0.1.166/artemis_model/zone_state.py +86 -0
  4. {artemis_model-0.1.164 → artemis_model-0.1.166}/pyproject.toml +1 -1
  5. {artemis_model-0.1.164 → artemis_model-0.1.166}/README.md +0 -0
  6. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/album.py +0 -0
  7. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/approved_playlist_list.py +0 -0
  8. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/artist.py +0 -0
  9. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/auth.py +0 -0
  10. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/banned_tracks.py +0 -0
  11. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/base.py +0 -0
  12. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/category.py +0 -0
  13. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/dj_set.py +0 -0
  14. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/genre.py +0 -0
  15. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/location.py +0 -0
  16. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/location_genre_exclusion.py +0 -0
  17. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/message.py +0 -0
  18. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/organization.py +0 -0
  19. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/organization_include_pal_setting.py +0 -0
  20. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/otp.py +0 -0
  21. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/permission.py +0 -0
  22. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/playlist.py +0 -0
  23. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/redis/__init__.py +0 -0
  24. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/redis/bucket.py +0 -0
  25. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/redis/device.py +0 -0
  26. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/redis/keys.py +0 -0
  27. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/redis/play_history.py +0 -0
  28. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/redis/zone_state.py +0 -0
  29. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/schedule.py +0 -0
  30. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/setting.py +0 -0
  31. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/sqs/__init__.py +0 -0
  32. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/sqs/messages.py +0 -0
  33. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/track.py +0 -0
  34. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/user.py +0 -0
  35. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/zone.py +0 -0
  36. {artemis_model-0.1.164 → artemis_model-0.1.166}/artemis_model/zone_activity.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: artemis-model
3
- Version: 0.1.164
3
+ Version: 0.1.166
4
4
  Summary:
5
5
  Author: Jukeboxy
6
6
  Requires-Python: >=3.10.6,<4.0.0
@@ -19,3 +19,4 @@ from artemis_model.zone import * # noqa
19
19
  from artemis_model.otp import * # noqa
20
20
  from artemis_model.banned_tracks import * # noqa
21
21
  from artemis_model.zone_activity import * # noqa
22
+ from artemis_model.zone_state import * # noqa
@@ -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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "artemis-model"
3
- version = "0.1.164"
3
+ version = "0.1.166"
4
4
  description = ""
5
5
  authors = ["Jukeboxy"]
6
6
  readme = "README.md"