/
__init__.py
52 lines (35 loc) · 1.19 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from typing import List
from dataclasses import dataclass
from ..paging import OffsetPaging
from ..show.base import Show
from ..serialise import Model, ModelList, Timestamp
@dataclass(repr=False)
class SimpleShow(Show):
"""
Simplified show object.
:attr:`total_episodes` is only available in
:meth:`Spotify.playback <tekore.Spotify.playback>` and
:meth:`Spotify.playback_currently_playing
<tekore.Spotify.playback_currently_playing>`.
"""
total_episodes: int = None
@dataclass(repr=False)
class SimpleShowPaging(OffsetPaging):
"""Paging of simplified shows."""
items: List[SimpleShow]
def __post_init__(self):
self.items = ModelList(SimpleShow(**i) for i in self.items)
@dataclass(repr=False)
class SavedShow(Model):
"""Show saved in library."""
added_at: Timestamp
show: SimpleShow
def __post_init__(self):
self.added_at = Timestamp.from_string(self.added_at)
self.show = SimpleShow(**self.show)
@dataclass(repr=False)
class SavedShowPaging(OffsetPaging):
"""Paging of shows in library."""
items: List[SavedShow]
def __post_init__(self):
self.items = ModelList(SavedShow(**i) for i in self.items)