artemis-model 0.1.88__tar.gz → 0.1.89__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.
- {artemis_model-0.1.88 → artemis_model-0.1.89}/PKG-INFO +1 -1
- artemis_model-0.1.89/artemis_model/redis/__init__.py +5 -0
- artemis_model-0.1.89/artemis_model/redis/zone_state.py +61 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/pyproject.toml +1 -1
- {artemis_model-0.1.88 → artemis_model-0.1.89}/README.md +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/__init__.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/album.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/artist.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/auth.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/base.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/category.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/dj_set.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/genre.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/location.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/message.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/organization.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/otp.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/permission.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/playlist.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/schedule.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/setting.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/track.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/user.py +0 -0
- {artemis_model-0.1.88 → artemis_model-0.1.89}/artemis_model/zone.py +0 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
"""Zone state schema."""
|
2
|
+
|
3
|
+
|
4
|
+
from dataclasses import Field
|
5
|
+
from typing import Annotated, Literal
|
6
|
+
|
7
|
+
from pydantic import BaseModel, field_validator
|
8
|
+
|
9
|
+
|
10
|
+
class NowPlaying(BaseModel):
|
11
|
+
"""Now playing schema."""
|
12
|
+
|
13
|
+
name: str = Field(description="The name of the track", default="UNKNOWN")
|
14
|
+
artist_name: str = Field(description="The artist name of the track", default="UNKNOWN")
|
15
|
+
album_name: str = Field(description="The album name of the track", default="UNKNOWN")
|
16
|
+
|
17
|
+
|
18
|
+
SessionId = Annotated[
|
19
|
+
int,
|
20
|
+
Field(
|
21
|
+
description="The session id of the pushed playlist. It's generated as a timestamp value of the current time."
|
22
|
+
),
|
23
|
+
]
|
24
|
+
BucketId = Annotated[
|
25
|
+
int | None,
|
26
|
+
Field(
|
27
|
+
description="The bucket id of the pushed playlist. It's calculated in set_bucket_track as the timestamp value of the timeslot."
|
28
|
+
),
|
29
|
+
]
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
class ZoneState(BaseModel):
|
34
|
+
"""Zone state schema."""
|
35
|
+
|
36
|
+
player_mode: Literal["scheduled", "pushplaylist"] = Field(
|
37
|
+
default="scheduled",
|
38
|
+
description="The mode of the player",
|
39
|
+
)
|
40
|
+
player_state: Literal["playing", "paused", "stopped", "ready"] = Field(
|
41
|
+
default="ready",
|
42
|
+
description="The state of the player",
|
43
|
+
)
|
44
|
+
now_playing: NowPlaying | None = Field(
|
45
|
+
default=None,
|
46
|
+
description="The currently playing track",
|
47
|
+
)
|
48
|
+
push_playlist_details: dict[SessionId, BucketId] | None = Field(
|
49
|
+
default_factory=dict,
|
50
|
+
description="The details of the pushed playlist",
|
51
|
+
)
|
52
|
+
|
53
|
+
@field_validator("push_playlist_details", mode="before")
|
54
|
+
@classmethod
|
55
|
+
def default_empty_dict_if_none(cls, v):
|
56
|
+
"""Override none value to empty dict."""
|
57
|
+
return v or {}
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
__all__ = ["ZoneState", "NowPlaying", "SessionId", "BucketId"]
|
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
|