spotifywebapiPython 1.0.242__py3-none-any.whl
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.
- spotifywebapipython/__init__.py +35 -0
- spotifywebapipython/const.py +114 -0
- spotifywebapipython/docs/__init__.html +2156 -0
- spotifywebapipython/docs/codecopy.js +70 -0
- spotifywebapipython/docs/index.html +514 -0
- spotifywebapipython/docs/search.js +46 -0
- spotifywebapipython/docs/spotifywebapipython/const.html +636 -0
- spotifywebapipython/docs/spotifywebapipython/saappmessages.html +540 -0
- spotifywebapipython/docs/spotifywebapipython/sautils.html +620 -0
- spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +341 -0
- spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +598 -0
- spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +612 -0
- spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +16557 -0
- spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +518 -0
- spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +421 -0
- spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +400 -0
- spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +635 -0
- spotifywebapipython/docs/spotifywebapipython.ico +0 -0
- spotifywebapipython/docs/spotifywebapipython_OLD.ico +0 -0
- spotifywebapipython/models/__init__.py +121 -0
- spotifywebapipython/models/album.py +170 -0
- spotifywebapipython/models/albumpagesaved.py +85 -0
- spotifywebapipython/models/albumpagesimplified.py +88 -0
- spotifywebapipython/models/albumsaved.py +102 -0
- spotifywebapipython/models/albumsimplified.py +308 -0
- spotifywebapipython/models/artist.py +146 -0
- spotifywebapipython/models/artistinfo.py +282 -0
- spotifywebapipython/models/artistinfotourevent.py +127 -0
- spotifywebapipython/models/artistpage.py +70 -0
- spotifywebapipython/models/artistsimplified.py +163 -0
- spotifywebapipython/models/audiobook.py +87 -0
- spotifywebapipython/models/audiobookpagesimplified.py +88 -0
- spotifywebapipython/models/audiobooksimplified.py +362 -0
- spotifywebapipython/models/audiofeatures.py +333 -0
- spotifywebapipython/models/author.py +67 -0
- spotifywebapipython/models/category.py +168 -0
- spotifywebapipython/models/categorypage.py +70 -0
- spotifywebapipython/models/chapter.py +84 -0
- spotifywebapipython/models/chapterpagesimplified.py +88 -0
- spotifywebapipython/models/chaptersimplified.py +387 -0
- spotifywebapipython/models/context.py +113 -0
- spotifywebapipython/models/copyright.py +79 -0
- spotifywebapipython/models/device.py +301 -0
- spotifywebapipython/models/episode.py +84 -0
- spotifywebapipython/models/episodepagesaved.py +85 -0
- spotifywebapipython/models/episodepagesimplified.py +88 -0
- spotifywebapipython/models/episodesaved.py +99 -0
- spotifywebapipython/models/episodesimplified.py +370 -0
- spotifywebapipython/models/explicitcontent.py +80 -0
- spotifywebapipython/models/externalids.py +91 -0
- spotifywebapipython/models/externalurls.py +104 -0
- spotifywebapipython/models/followers.py +81 -0
- spotifywebapipython/models/imageobject.py +193 -0
- spotifywebapipython/models/imagevibrantcolors.py +182 -0
- spotifywebapipython/models/linkedfrom.py +165 -0
- spotifywebapipython/models/narrator.py +67 -0
- spotifywebapipython/models/owner.py +162 -0
- spotifywebapipython/models/pageobject.py +343 -0
- spotifywebapipython/models/playeractions.py +196 -0
- spotifywebapipython/models/playerlastplayedinfo.py +334 -0
- spotifywebapipython/models/playerplaystate.py +467 -0
- spotifywebapipython/models/playerqueueinfo.py +207 -0
- spotifywebapipython/models/playhistory.py +136 -0
- spotifywebapipython/models/playhistorypage.py +85 -0
- spotifywebapipython/models/playlist.py +125 -0
- spotifywebapipython/models/playlistpage.py +85 -0
- spotifywebapipython/models/playlistpagesimplified.py +107 -0
- spotifywebapipython/models/playlistsimplified.py +334 -0
- spotifywebapipython/models/playlisttrack.py +143 -0
- spotifywebapipython/models/playlisttracksummary.py +80 -0
- spotifywebapipython/models/recommendationseed.py +135 -0
- spotifywebapipython/models/restrictions.py +86 -0
- spotifywebapipython/models/resumepoint.py +79 -0
- spotifywebapipython/models/searchresponse.py +391 -0
- spotifywebapipython/models/searchresultbase.py +299 -0
- spotifywebapipython/models/show.py +87 -0
- spotifywebapipython/models/showpagesaved.py +85 -0
- spotifywebapipython/models/showpagesimplified.py +88 -0
- spotifywebapipython/models/showsaved.py +99 -0
- spotifywebapipython/models/showsimplified.py +320 -0
- spotifywebapipython/models/spotifyconnectdevice.py +321 -0
- spotifywebapipython/models/spotifyconnectdevices.py +441 -0
- spotifywebapipython/models/track.py +142 -0
- spotifywebapipython/models/trackpage.py +110 -0
- spotifywebapipython/models/trackpagesaved.py +85 -0
- spotifywebapipython/models/trackpagesimplified.py +88 -0
- spotifywebapipython/models/trackrecommendations.py +88 -0
- spotifywebapipython/models/tracksaved.py +99 -0
- spotifywebapipython/models/tracksimplified.py +398 -0
- spotifywebapipython/models/userprofile.py +184 -0
- spotifywebapipython/models/userprofilesimplified.py +206 -0
- spotifywebapipython/models/zeroconfdiscoveryresult.py +592 -0
- spotifywebapipython/models/zeroconfproperty.py +93 -0
- spotifywebapipython/oauthcli/__init__.py +7 -0
- spotifywebapipython/oauthcli/authclient.py +1229 -0
- spotifywebapipython/saappmessages.py +86 -0
- spotifywebapipython/sautils.py +285 -0
- spotifywebapipython/spotifyapierror.py +66 -0
- spotifywebapipython/spotifyapimessage.py +269 -0
- spotifywebapipython/spotifyauthtoken.py +264 -0
- spotifywebapipython/spotifyclient.py +17885 -0
- spotifywebapipython/spotifyconnect/__init__.py +19 -0
- spotifywebapipython/spotifyconnect/spotifyconnectdeviceeventargs.py +67 -0
- spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +2564 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastapptask.py +467 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastcontroller.py +701 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastlistener.py +359 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastmultizonelistener.py +212 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconfexceptions.py +20 -0
- spotifywebapipython/spotifyconnect/spotifyconnectzeroconflistener.py +335 -0
- spotifywebapipython/spotifydiscovery.py +473 -0
- spotifywebapipython/spotifymediatypes.py +53 -0
- spotifywebapipython/spotifywebapiauthenticationerror.py +122 -0
- spotifywebapipython/spotifywebapierror.py +106 -0
- spotifywebapipython/spotifywebplayertoken.py +743 -0
- spotifywebapipython/vibrant/__init__.py +17 -0
- spotifywebapipython/vibrant/generator.py +261 -0
- spotifywebapipython/vibrant/image.py +100 -0
- spotifywebapipython/vibrant/main.py +34 -0
- spotifywebapipython/vibrant/models.py +93 -0
- spotifywebapipython/vibrant/utils.py +56 -0
- spotifywebapipython/zeroconfapi/__init__.py +23 -0
- spotifywebapipython/zeroconfapi/authenticationtypes.py +38 -0
- spotifywebapipython/zeroconfapi/blobbuilder.py +370 -0
- spotifywebapipython/zeroconfapi/credentials.py +37 -0
- spotifywebapipython/zeroconfapi/cryptodiffiehellman.py +89 -0
- spotifywebapipython/zeroconfapi/helpers.py +64 -0
- spotifywebapipython/zeroconfapi/spotifyzeroconfapierror.py +108 -0
- spotifywebapipython/zeroconfapi/zeroconfconnect.py +1327 -0
- spotifywebapipython/zeroconfapi/zeroconfgetinfo.py +572 -0
- spotifywebapipython/zeroconfapi/zeroconfgetinfoalias.py +109 -0
- spotifywebapipython/zeroconfapi/zeroconfgetinfodrmmediaformat.py +90 -0
- spotifywebapipython/zeroconfapi/zeroconfresponse.py +195 -0
- spotifywebapipython-1.0.242.dist-info/LICENSE +22 -0
- spotifywebapipython-1.0.242.dist-info/METADATA +219 -0
- spotifywebapipython-1.0.242.dist-info/RECORD +138 -0
- spotifywebapipython-1.0.242.dist-info/WHEEL +5 -0
- spotifywebapipython-1.0.242.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
|
|
6
|
+
@export
|
|
7
|
+
class Copyright:
|
|
8
|
+
"""
|
|
9
|
+
Spotify Web API Content Copyright object.
|
|
10
|
+
|
|
11
|
+
Contains information about content copyrights.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, root:dict=None) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Initializes a new instance of the class.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
root (dict):
|
|
20
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
21
|
+
attributes; otherwise, None to not load attributes.
|
|
22
|
+
"""
|
|
23
|
+
self._Text:str = None
|
|
24
|
+
self._Type:str = None
|
|
25
|
+
|
|
26
|
+
if (root is None):
|
|
27
|
+
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
else:
|
|
31
|
+
|
|
32
|
+
self._Text = root.get('text', None)
|
|
33
|
+
self._Type = root.get('type', None)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def __repr__(self) -> str:
|
|
37
|
+
return self.ToString()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def __str__(self) -> str:
|
|
41
|
+
return self.ToString()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def Text(self) -> str:
|
|
46
|
+
"""
|
|
47
|
+
The copyright text for this content.
|
|
48
|
+
"""
|
|
49
|
+
return self._Text
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def Type(self) -> str:
|
|
54
|
+
"""
|
|
55
|
+
The type of copyright: C = the copyright, P = the sound recording (performance) copyright.
|
|
56
|
+
"""
|
|
57
|
+
return self._Type
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def ToDictionary(self) -> dict:
|
|
61
|
+
"""
|
|
62
|
+
Returns a dictionary representation of the class.
|
|
63
|
+
"""
|
|
64
|
+
result:dict = \
|
|
65
|
+
{
|
|
66
|
+
'text': self._Text,
|
|
67
|
+
'type': self._Type
|
|
68
|
+
}
|
|
69
|
+
return result
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def ToString(self) -> str:
|
|
73
|
+
"""
|
|
74
|
+
Returns a displayable string representation of the class.
|
|
75
|
+
"""
|
|
76
|
+
msg:str = 'Copyright:'
|
|
77
|
+
if self._Type is not None: msg = '%s\n Type="%s"' % (msg, str(self._Type))
|
|
78
|
+
if self._Text is not None: msg = '%s\n Text="%s"' % (msg, str(self._Text))
|
|
79
|
+
return msg
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
|
|
6
|
+
@export
|
|
7
|
+
class Device:
|
|
8
|
+
"""
|
|
9
|
+
Spotify Web API Device object.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, root:dict=None) -> None:
|
|
13
|
+
"""
|
|
14
|
+
Initializes a new instance of the class.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
root (dict):
|
|
18
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
19
|
+
attributes; otherwise, None to not load attributes.
|
|
20
|
+
"""
|
|
21
|
+
# initialize storage.
|
|
22
|
+
self._Id:str = None
|
|
23
|
+
self._IsActive:bool = None
|
|
24
|
+
self._IsPrivateSession:bool = None
|
|
25
|
+
self._IsRestricted:bool = None
|
|
26
|
+
self._Name:str = None
|
|
27
|
+
self._SupportsVolume:bool = None
|
|
28
|
+
self._Type:str = None
|
|
29
|
+
self._VolumePercent:int = None
|
|
30
|
+
|
|
31
|
+
if (root is None):
|
|
32
|
+
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
else:
|
|
36
|
+
|
|
37
|
+
self._Id = root.get('id', None)
|
|
38
|
+
self._IsActive = root.get('is_active', None)
|
|
39
|
+
self._IsPrivateSession = root.get('is_private_session', None)
|
|
40
|
+
self._IsRestricted = root.get('is_restricted', None)
|
|
41
|
+
self._Name = root.get('name', None)
|
|
42
|
+
self._SupportsVolume = root.get('supports_volume', None)
|
|
43
|
+
self._Type = root.get('type', None)
|
|
44
|
+
self._VolumePercent = root.get('volume_percent', None)
|
|
45
|
+
|
|
46
|
+
# post load validations.
|
|
47
|
+
if self._IsActive is None:
|
|
48
|
+
self._IsActive = False
|
|
49
|
+
if self._IsPrivateSession is None:
|
|
50
|
+
self._IsPrivateSession = False
|
|
51
|
+
if self._IsRestricted is None:
|
|
52
|
+
self._IsRestricted = False
|
|
53
|
+
if self._SupportsVolume is None:
|
|
54
|
+
self._SupportsVolume = False
|
|
55
|
+
if self._VolumePercent is None:
|
|
56
|
+
self._VolumePercent = 0
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def __repr__(self) -> str:
|
|
60
|
+
return self.ToString()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def __str__(self) -> str:
|
|
64
|
+
return self.ToString()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# implement sorting support.
|
|
68
|
+
def __eq__(self, other):
|
|
69
|
+
try:
|
|
70
|
+
return self.Name == other.Name
|
|
71
|
+
except Exception as ex:
|
|
72
|
+
if (isinstance(self, Device )) and (isinstance(other, Device )):
|
|
73
|
+
return self.Name == other.Name
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
def __lt__(self, other):
|
|
77
|
+
try:
|
|
78
|
+
return self.Name < other.Name
|
|
79
|
+
except Exception as ex:
|
|
80
|
+
if (isinstance(self, Device )) and (isinstance(other, Device )):
|
|
81
|
+
return self.Name < other.Name
|
|
82
|
+
return False
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def Id(self) -> str:
|
|
87
|
+
"""
|
|
88
|
+
The device ID.
|
|
89
|
+
|
|
90
|
+
This ID is unique and persistent to some extent. However, this is not guaranteed
|
|
91
|
+
and any cached device_id should periodically be cleared out and refetched as necessary.
|
|
92
|
+
"""
|
|
93
|
+
return self._Id
|
|
94
|
+
|
|
95
|
+
@Id.setter
|
|
96
|
+
def Id(self, value:str):
|
|
97
|
+
"""
|
|
98
|
+
Sets the Id property value.
|
|
99
|
+
"""
|
|
100
|
+
if isinstance(value, str):
|
|
101
|
+
self._Id = value
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def IsActive(self) -> bool:
|
|
106
|
+
"""
|
|
107
|
+
If this device is the currently active device.
|
|
108
|
+
"""
|
|
109
|
+
return self._IsActive
|
|
110
|
+
|
|
111
|
+
@IsActive.setter
|
|
112
|
+
def IsActive(self, value:bool):
|
|
113
|
+
"""
|
|
114
|
+
Sets the IsActive property value.
|
|
115
|
+
"""
|
|
116
|
+
if isinstance(value, bool):
|
|
117
|
+
self._IsActive = value
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def IsMuted(self) -> bool:
|
|
122
|
+
"""
|
|
123
|
+
True if the player device volume is zero (muted);
|
|
124
|
+
otherwise, false.
|
|
125
|
+
"""
|
|
126
|
+
return (self._VolumePercent == 0)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@property
|
|
130
|
+
def IsPrivateSession(self) -> bool:
|
|
131
|
+
"""
|
|
132
|
+
If this device is currently in a private session.
|
|
133
|
+
"""
|
|
134
|
+
return self._IsPrivateSession
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@property
|
|
138
|
+
def IsRestricted(self) -> bool:
|
|
139
|
+
"""
|
|
140
|
+
Whether controlling this device is restricted.
|
|
141
|
+
|
|
142
|
+
At present if this is "true" then no Web API commands will be accepted by this device.
|
|
143
|
+
"""
|
|
144
|
+
return self._IsRestricted
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def Name(self) -> str:
|
|
149
|
+
"""
|
|
150
|
+
A human-readable name for the device.
|
|
151
|
+
|
|
152
|
+
Some devices have a name that the user can configure (e.g. "Loudest speaker") and some
|
|
153
|
+
devices have a generic name associated with the manufacturer or device model.
|
|
154
|
+
|
|
155
|
+
Example: `Kitchen speaker`
|
|
156
|
+
"""
|
|
157
|
+
return self._Name
|
|
158
|
+
|
|
159
|
+
@Name.setter
|
|
160
|
+
def Name(self, value:str):
|
|
161
|
+
"""
|
|
162
|
+
Sets the Name property value.
|
|
163
|
+
"""
|
|
164
|
+
if isinstance(value, str):
|
|
165
|
+
self._Name = value
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@property
|
|
169
|
+
def SelectItemNameAndId(self) -> str:
|
|
170
|
+
"""
|
|
171
|
+
Returns a string that can be used in a selection list in the
|
|
172
|
+
form of "Name (Id)".
|
|
173
|
+
|
|
174
|
+
This is a helper property, and not part of the Spotify Web API interface.
|
|
175
|
+
"""
|
|
176
|
+
return "%s (%s)" % (self.Name, self.Id)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
@property
|
|
180
|
+
def SupportsVolume(self) -> bool:
|
|
181
|
+
"""
|
|
182
|
+
If this device can be used to set the volume.
|
|
183
|
+
"""
|
|
184
|
+
return self._SupportsVolume
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@property
|
|
188
|
+
def Type(self) -> str:
|
|
189
|
+
"""
|
|
190
|
+
Device type, such as `computer`, `smartphone` or `speaker`.
|
|
191
|
+
|
|
192
|
+
Example: `computer`
|
|
193
|
+
"""
|
|
194
|
+
return self._Type
|
|
195
|
+
|
|
196
|
+
@Type.setter
|
|
197
|
+
def Type(self, value:str):
|
|
198
|
+
"""
|
|
199
|
+
Sets the Type property value.
|
|
200
|
+
"""
|
|
201
|
+
if isinstance(value, str):
|
|
202
|
+
self._Type = value
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
@property
|
|
206
|
+
def VolumePercent(self) -> int:
|
|
207
|
+
"""
|
|
208
|
+
The current volume in percent.
|
|
209
|
+
|
|
210
|
+
Range: `0 - 100`
|
|
211
|
+
Example: `59`
|
|
212
|
+
"""
|
|
213
|
+
return self._VolumePercent
|
|
214
|
+
|
|
215
|
+
@VolumePercent.setter
|
|
216
|
+
def VolumePercent(self, value:int):
|
|
217
|
+
"""
|
|
218
|
+
Sets the VolumePercent property value.
|
|
219
|
+
"""
|
|
220
|
+
if isinstance(value, int):
|
|
221
|
+
self._VolumePercent = value
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
@staticmethod
|
|
225
|
+
def GetIdFromSelectItem(value:str) -> str:
|
|
226
|
+
"""
|
|
227
|
+
Returns the Id portion of a `SelectItemNameAndId` property value.
|
|
228
|
+
|
|
229
|
+
Args:
|
|
230
|
+
value (str):
|
|
231
|
+
A `SelectItemNameAndId` property value.
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
The Id portion of a `SelectItemNameAndId` property value, or None
|
|
235
|
+
if the Id portion could not be determined.
|
|
236
|
+
"""
|
|
237
|
+
result:str = None
|
|
238
|
+
if isinstance(value, str):
|
|
239
|
+
idx:int = value.rfind("(")
|
|
240
|
+
if idx > -1:
|
|
241
|
+
result = value[idx+1:len(value)-1] # drop the "(" and ")"
|
|
242
|
+
return result
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
@staticmethod
|
|
246
|
+
def GetNameFromSelectItem(value:str) -> str:
|
|
247
|
+
"""
|
|
248
|
+
Returns the Name portion of a `SelectItemNameAndId` property value.
|
|
249
|
+
|
|
250
|
+
Args:
|
|
251
|
+
value (str):
|
|
252
|
+
A `SelectItemNameAndId` property value.
|
|
253
|
+
|
|
254
|
+
Returns:
|
|
255
|
+
The Name portion of a `SelectItemNameAndId` property value, or None
|
|
256
|
+
if the Name portion could not be determined.
|
|
257
|
+
"""
|
|
258
|
+
result:str = None
|
|
259
|
+
if isinstance(value, str):
|
|
260
|
+
idx:int = value.rfind("(")
|
|
261
|
+
if idx > -1:
|
|
262
|
+
result = value[:idx-1]
|
|
263
|
+
return result
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def ToDictionary(self) -> dict:
|
|
267
|
+
"""
|
|
268
|
+
Returns a dictionary representation of the class.
|
|
269
|
+
"""
|
|
270
|
+
result:dict = \
|
|
271
|
+
{
|
|
272
|
+
'id': self._Id,
|
|
273
|
+
'is_active': self._IsActive,
|
|
274
|
+
'is_private_session': self._IsPrivateSession,
|
|
275
|
+
'is_restricted': self._IsRestricted,
|
|
276
|
+
'name': self._Name,
|
|
277
|
+
'supports_volume': self._SupportsVolume,
|
|
278
|
+
'type': self._Type,
|
|
279
|
+
'volume_percent': self._VolumePercent,
|
|
280
|
+
# helper property(s), not part of the Spotify Web API interface:
|
|
281
|
+
'is_muted': self.IsMuted,
|
|
282
|
+
'select_item_name_and_id': self.SelectItemNameAndId,
|
|
283
|
+
}
|
|
284
|
+
return result
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def ToString(self) -> str:
|
|
288
|
+
"""
|
|
289
|
+
Returns a displayable string representation of the class.
|
|
290
|
+
"""
|
|
291
|
+
msg:str = 'Device:'
|
|
292
|
+
if self._Id is not None: msg = '%s\n Id="%s"' % (msg, str(self._Id))
|
|
293
|
+
if self._IsActive is not None: msg = '%s\n IsActive="%s"' % (msg, str(self._IsActive))
|
|
294
|
+
if self.IsMuted is not None: msg = '%s\n IsMuted="%s"' % (msg, str(self.IsMuted))
|
|
295
|
+
if self._IsPrivateSession is not None: msg = '%s\n IsPrivateSession="%s"' % (msg, str(self._IsPrivateSession))
|
|
296
|
+
if self._IsRestricted is not None: msg = '%s\n IsRestricted="%s"' % (msg, str(self._IsRestricted))
|
|
297
|
+
if self._Name is not None: msg = '%s\n Name="%s"' % (msg, str(self._Name))
|
|
298
|
+
if self._SupportsVolume is not None: msg = '%s\n SupportsVolume="%s"' % (msg, str(self._SupportsVolume))
|
|
299
|
+
if self._Type is not None: msg = '%s\n Type="%s"' % (msg, str(self._Type))
|
|
300
|
+
if self._VolumePercent is not None: msg = '%s\n VolumePercent="%s"' % (msg, str(self._VolumePercent))
|
|
301
|
+
return msg
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
from .episodesimplified import EpisodeSimplified
|
|
6
|
+
from .showsimplified import ShowSimplified
|
|
7
|
+
|
|
8
|
+
@export
|
|
9
|
+
class Episode(EpisodeSimplified):
|
|
10
|
+
"""
|
|
11
|
+
Spotify Web API Episode object.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, root:dict=None) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Initializes a new instance of the class.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
root (dict):
|
|
20
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
21
|
+
attributes; otherwise, None to not load attributes.
|
|
22
|
+
"""
|
|
23
|
+
# initialize base class.
|
|
24
|
+
super().__init__(root=root)
|
|
25
|
+
|
|
26
|
+
self._Show:ShowSimplified = None
|
|
27
|
+
|
|
28
|
+
if (root is None):
|
|
29
|
+
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
else:
|
|
33
|
+
|
|
34
|
+
# process all collections and objects.
|
|
35
|
+
item:dict = root.get('show',None)
|
|
36
|
+
if item is not None:
|
|
37
|
+
self._Show = ShowSimplified(root=item)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def __repr__(self) -> str:
|
|
41
|
+
return self.ToString()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def __str__(self) -> str:
|
|
45
|
+
return self.ToString()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def Show(self) -> ShowSimplified:
|
|
50
|
+
"""
|
|
51
|
+
The show on which the episode belongs.
|
|
52
|
+
|
|
53
|
+
This is a `ShowSimplified` object.
|
|
54
|
+
"""
|
|
55
|
+
return self._Show
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def ToDictionary(self) -> dict:
|
|
59
|
+
"""
|
|
60
|
+
Returns a dictionary representation of the class.
|
|
61
|
+
"""
|
|
62
|
+
# get base class result.
|
|
63
|
+
resultBase:dict = super().ToDictionary()
|
|
64
|
+
|
|
65
|
+
result:dict = \
|
|
66
|
+
{
|
|
67
|
+
'show': self._Show.ToDictionary(),
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# combine base class results with these results.
|
|
71
|
+
resultBase.update(result)
|
|
72
|
+
|
|
73
|
+
# return a sorted dictionary.
|
|
74
|
+
return dict(sorted(resultBase.items()))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def ToString(self) -> str:
|
|
78
|
+
"""
|
|
79
|
+
Returns a displayable string representation of the class.
|
|
80
|
+
"""
|
|
81
|
+
msg:str = 'Episode: %s' % super().ToString(False)
|
|
82
|
+
if self._Show is not None: msg = '%s\n Show Name="%s"' % (msg, str(self._Show.Name))
|
|
83
|
+
return msg
|
|
84
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
from .episode import Episode
|
|
6
|
+
from .episodesaved import EpisodeSaved
|
|
7
|
+
from .pageobject import PageObject
|
|
8
|
+
|
|
9
|
+
@export
|
|
10
|
+
class EpisodePageSaved(PageObject):
|
|
11
|
+
"""
|
|
12
|
+
Spotify Web API EpisodePageSaved object.
|
|
13
|
+
|
|
14
|
+
This allows for multiple pages of `EpisodeSaved` objects to be navigated.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, root:dict=None) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Initializes a new instance of the class.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
root (dict):
|
|
23
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
24
|
+
attributes; otherwise, None to not load attributes.
|
|
25
|
+
"""
|
|
26
|
+
# initialize base class.
|
|
27
|
+
super().__init__(root=root)
|
|
28
|
+
|
|
29
|
+
# initialize storage.
|
|
30
|
+
self._Items:list[EpisodeSaved] = []
|
|
31
|
+
|
|
32
|
+
if (root is None):
|
|
33
|
+
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
else:
|
|
37
|
+
|
|
38
|
+
# process all collections and objects.
|
|
39
|
+
items:list = root.get('items',None)
|
|
40
|
+
if items is not None:
|
|
41
|
+
for item in items:
|
|
42
|
+
if item is not None:
|
|
43
|
+
self._Items.append(EpisodeSaved(root=item))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __repr__(self) -> str:
|
|
47
|
+
return self.ToString()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def __str__(self) -> str:
|
|
51
|
+
return self.ToString()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def Items(self) -> list[EpisodeSaved]:
|
|
56
|
+
"""
|
|
57
|
+
Array of `EpisodeSaved` objects.
|
|
58
|
+
"""
|
|
59
|
+
return self._Items
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def GetEpisodes(self) -> list[Episode]:
|
|
63
|
+
"""
|
|
64
|
+
Gets a list of all episodes contained in the underlying `Items` list.
|
|
65
|
+
|
|
66
|
+
This is a convenience method so one does not have to loop through the `Items`
|
|
67
|
+
array of EpisodeSaved objects to get the list of episodes.
|
|
68
|
+
"""
|
|
69
|
+
result:list[Episode] = []
|
|
70
|
+
item:EpisodeSaved
|
|
71
|
+
for item in self._Items:
|
|
72
|
+
result.append(item.Episode)
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def ToString(self, includeItems:bool=False) -> str:
|
|
77
|
+
"""
|
|
78
|
+
Returns a displayable string representation of the class.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
includeItems (bool):
|
|
82
|
+
True to include the Items collection of objects; otherwise, False
|
|
83
|
+
to only return base properties.
|
|
84
|
+
"""
|
|
85
|
+
return 'EpisodePageSaved: %s' % super().ToString(includeItems)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# external package imports.
|
|
2
|
+
|
|
3
|
+
# our package imports.
|
|
4
|
+
from ..sautils import export
|
|
5
|
+
from .episodesimplified import EpisodeSimplified
|
|
6
|
+
from .pageobject import PageObject
|
|
7
|
+
|
|
8
|
+
@export
|
|
9
|
+
class EpisodePageSimplified(PageObject):
|
|
10
|
+
"""
|
|
11
|
+
Spotify Web API SimplifiedEpisodePage object.
|
|
12
|
+
|
|
13
|
+
This allows for multiple pages of `EpisodeSimplified` objects to be navigated.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(self, root:dict=None) -> None:
|
|
17
|
+
"""
|
|
18
|
+
Initializes a new instance of the class.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
root (dict):
|
|
22
|
+
Spotify Web API JSON response in dictionary format, used to load object
|
|
23
|
+
attributes; otherwise, None to not load attributes.
|
|
24
|
+
"""
|
|
25
|
+
# initialize base class.
|
|
26
|
+
super().__init__(root=root)
|
|
27
|
+
|
|
28
|
+
# initialize storage.
|
|
29
|
+
self._Items:list[EpisodeSimplified] = []
|
|
30
|
+
|
|
31
|
+
if (root is None):
|
|
32
|
+
|
|
33
|
+
self._Total = 0
|
|
34
|
+
|
|
35
|
+
else:
|
|
36
|
+
|
|
37
|
+
# process all collections and objects.
|
|
38
|
+
items:list = root.get('items',None)
|
|
39
|
+
if items is not None:
|
|
40
|
+
for item in items:
|
|
41
|
+
if item is not None:
|
|
42
|
+
self._Items.append(EpisodeSimplified(root=item))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def __repr__(self) -> str:
|
|
46
|
+
return self.ToString()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def __str__(self) -> str:
|
|
50
|
+
return self.ToString()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def Items(self) -> list[EpisodeSimplified]:
|
|
55
|
+
"""
|
|
56
|
+
Array of `EpisodeSimplified` objects.
|
|
57
|
+
"""
|
|
58
|
+
return self._Items
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def ContainsId(self, itemId:str=False) -> bool:
|
|
62
|
+
"""
|
|
63
|
+
Checks the `Items` collection to see if an item already exists with the
|
|
64
|
+
specified Id value.
|
|
65
|
+
|
|
66
|
+
Returns True if the itemId exists in the collection; otherwise, False.
|
|
67
|
+
"""
|
|
68
|
+
result:bool = False
|
|
69
|
+
|
|
70
|
+
item:EpisodeSimplified
|
|
71
|
+
for item in self._Items:
|
|
72
|
+
if item.Id == itemId:
|
|
73
|
+
result = True
|
|
74
|
+
break
|
|
75
|
+
|
|
76
|
+
return result
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def ToString(self, includeItems:bool=False) -> str:
|
|
80
|
+
"""
|
|
81
|
+
Returns a displayable string representation of the class.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
includeItems (bool):
|
|
85
|
+
True to include the Items collection of objects; otherwise, False
|
|
86
|
+
to only return base properties.
|
|
87
|
+
"""
|
|
88
|
+
return 'EpisodePageSimplified: %s' % super().ToString(includeItems)
|