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.
Files changed (138) hide show
  1. spotifywebapipython/__init__.py +35 -0
  2. spotifywebapipython/const.py +114 -0
  3. spotifywebapipython/docs/__init__.html +2156 -0
  4. spotifywebapipython/docs/codecopy.js +70 -0
  5. spotifywebapipython/docs/index.html +514 -0
  6. spotifywebapipython/docs/search.js +46 -0
  7. spotifywebapipython/docs/spotifywebapipython/const.html +636 -0
  8. spotifywebapipython/docs/spotifywebapipython/saappmessages.html +540 -0
  9. spotifywebapipython/docs/spotifywebapipython/sautils.html +620 -0
  10. spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +341 -0
  11. spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +598 -0
  12. spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +612 -0
  13. spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +16557 -0
  14. spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +518 -0
  15. spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +421 -0
  16. spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +400 -0
  17. spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +635 -0
  18. spotifywebapipython/docs/spotifywebapipython.ico +0 -0
  19. spotifywebapipython/docs/spotifywebapipython_OLD.ico +0 -0
  20. spotifywebapipython/models/__init__.py +121 -0
  21. spotifywebapipython/models/album.py +170 -0
  22. spotifywebapipython/models/albumpagesaved.py +85 -0
  23. spotifywebapipython/models/albumpagesimplified.py +88 -0
  24. spotifywebapipython/models/albumsaved.py +102 -0
  25. spotifywebapipython/models/albumsimplified.py +308 -0
  26. spotifywebapipython/models/artist.py +146 -0
  27. spotifywebapipython/models/artistinfo.py +282 -0
  28. spotifywebapipython/models/artistinfotourevent.py +127 -0
  29. spotifywebapipython/models/artistpage.py +70 -0
  30. spotifywebapipython/models/artistsimplified.py +163 -0
  31. spotifywebapipython/models/audiobook.py +87 -0
  32. spotifywebapipython/models/audiobookpagesimplified.py +88 -0
  33. spotifywebapipython/models/audiobooksimplified.py +362 -0
  34. spotifywebapipython/models/audiofeatures.py +333 -0
  35. spotifywebapipython/models/author.py +67 -0
  36. spotifywebapipython/models/category.py +168 -0
  37. spotifywebapipython/models/categorypage.py +70 -0
  38. spotifywebapipython/models/chapter.py +84 -0
  39. spotifywebapipython/models/chapterpagesimplified.py +88 -0
  40. spotifywebapipython/models/chaptersimplified.py +387 -0
  41. spotifywebapipython/models/context.py +113 -0
  42. spotifywebapipython/models/copyright.py +79 -0
  43. spotifywebapipython/models/device.py +301 -0
  44. spotifywebapipython/models/episode.py +84 -0
  45. spotifywebapipython/models/episodepagesaved.py +85 -0
  46. spotifywebapipython/models/episodepagesimplified.py +88 -0
  47. spotifywebapipython/models/episodesaved.py +99 -0
  48. spotifywebapipython/models/episodesimplified.py +370 -0
  49. spotifywebapipython/models/explicitcontent.py +80 -0
  50. spotifywebapipython/models/externalids.py +91 -0
  51. spotifywebapipython/models/externalurls.py +104 -0
  52. spotifywebapipython/models/followers.py +81 -0
  53. spotifywebapipython/models/imageobject.py +193 -0
  54. spotifywebapipython/models/imagevibrantcolors.py +182 -0
  55. spotifywebapipython/models/linkedfrom.py +165 -0
  56. spotifywebapipython/models/narrator.py +67 -0
  57. spotifywebapipython/models/owner.py +162 -0
  58. spotifywebapipython/models/pageobject.py +343 -0
  59. spotifywebapipython/models/playeractions.py +196 -0
  60. spotifywebapipython/models/playerlastplayedinfo.py +334 -0
  61. spotifywebapipython/models/playerplaystate.py +467 -0
  62. spotifywebapipython/models/playerqueueinfo.py +207 -0
  63. spotifywebapipython/models/playhistory.py +136 -0
  64. spotifywebapipython/models/playhistorypage.py +85 -0
  65. spotifywebapipython/models/playlist.py +125 -0
  66. spotifywebapipython/models/playlistpage.py +85 -0
  67. spotifywebapipython/models/playlistpagesimplified.py +107 -0
  68. spotifywebapipython/models/playlistsimplified.py +334 -0
  69. spotifywebapipython/models/playlisttrack.py +143 -0
  70. spotifywebapipython/models/playlisttracksummary.py +80 -0
  71. spotifywebapipython/models/recommendationseed.py +135 -0
  72. spotifywebapipython/models/restrictions.py +86 -0
  73. spotifywebapipython/models/resumepoint.py +79 -0
  74. spotifywebapipython/models/searchresponse.py +391 -0
  75. spotifywebapipython/models/searchresultbase.py +299 -0
  76. spotifywebapipython/models/show.py +87 -0
  77. spotifywebapipython/models/showpagesaved.py +85 -0
  78. spotifywebapipython/models/showpagesimplified.py +88 -0
  79. spotifywebapipython/models/showsaved.py +99 -0
  80. spotifywebapipython/models/showsimplified.py +320 -0
  81. spotifywebapipython/models/spotifyconnectdevice.py +321 -0
  82. spotifywebapipython/models/spotifyconnectdevices.py +441 -0
  83. spotifywebapipython/models/track.py +142 -0
  84. spotifywebapipython/models/trackpage.py +110 -0
  85. spotifywebapipython/models/trackpagesaved.py +85 -0
  86. spotifywebapipython/models/trackpagesimplified.py +88 -0
  87. spotifywebapipython/models/trackrecommendations.py +88 -0
  88. spotifywebapipython/models/tracksaved.py +99 -0
  89. spotifywebapipython/models/tracksimplified.py +398 -0
  90. spotifywebapipython/models/userprofile.py +184 -0
  91. spotifywebapipython/models/userprofilesimplified.py +206 -0
  92. spotifywebapipython/models/zeroconfdiscoveryresult.py +592 -0
  93. spotifywebapipython/models/zeroconfproperty.py +93 -0
  94. spotifywebapipython/oauthcli/__init__.py +7 -0
  95. spotifywebapipython/oauthcli/authclient.py +1229 -0
  96. spotifywebapipython/saappmessages.py +86 -0
  97. spotifywebapipython/sautils.py +285 -0
  98. spotifywebapipython/spotifyapierror.py +66 -0
  99. spotifywebapipython/spotifyapimessage.py +269 -0
  100. spotifywebapipython/spotifyauthtoken.py +264 -0
  101. spotifywebapipython/spotifyclient.py +17885 -0
  102. spotifywebapipython/spotifyconnect/__init__.py +19 -0
  103. spotifywebapipython/spotifyconnect/spotifyconnectdeviceeventargs.py +67 -0
  104. spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +2564 -0
  105. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastapptask.py +467 -0
  106. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastcontroller.py +701 -0
  107. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastlistener.py +359 -0
  108. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfcastmultizonelistener.py +212 -0
  109. spotifywebapipython/spotifyconnect/spotifyconnectzeroconfexceptions.py +20 -0
  110. spotifywebapipython/spotifyconnect/spotifyconnectzeroconflistener.py +335 -0
  111. spotifywebapipython/spotifydiscovery.py +473 -0
  112. spotifywebapipython/spotifymediatypes.py +53 -0
  113. spotifywebapipython/spotifywebapiauthenticationerror.py +122 -0
  114. spotifywebapipython/spotifywebapierror.py +106 -0
  115. spotifywebapipython/spotifywebplayertoken.py +743 -0
  116. spotifywebapipython/vibrant/__init__.py +17 -0
  117. spotifywebapipython/vibrant/generator.py +261 -0
  118. spotifywebapipython/vibrant/image.py +100 -0
  119. spotifywebapipython/vibrant/main.py +34 -0
  120. spotifywebapipython/vibrant/models.py +93 -0
  121. spotifywebapipython/vibrant/utils.py +56 -0
  122. spotifywebapipython/zeroconfapi/__init__.py +23 -0
  123. spotifywebapipython/zeroconfapi/authenticationtypes.py +38 -0
  124. spotifywebapipython/zeroconfapi/blobbuilder.py +370 -0
  125. spotifywebapipython/zeroconfapi/credentials.py +37 -0
  126. spotifywebapipython/zeroconfapi/cryptodiffiehellman.py +89 -0
  127. spotifywebapipython/zeroconfapi/helpers.py +64 -0
  128. spotifywebapipython/zeroconfapi/spotifyzeroconfapierror.py +108 -0
  129. spotifywebapipython/zeroconfapi/zeroconfconnect.py +1327 -0
  130. spotifywebapipython/zeroconfapi/zeroconfgetinfo.py +572 -0
  131. spotifywebapipython/zeroconfapi/zeroconfgetinfoalias.py +109 -0
  132. spotifywebapipython/zeroconfapi/zeroconfgetinfodrmmediaformat.py +90 -0
  133. spotifywebapipython/zeroconfapi/zeroconfresponse.py +195 -0
  134. spotifywebapipython-1.0.242.dist-info/LICENSE +22 -0
  135. spotifywebapipython-1.0.242.dist-info/METADATA +219 -0
  136. spotifywebapipython-1.0.242.dist-info/RECORD +138 -0
  137. spotifywebapipython-1.0.242.dist-info/WHEEL +5 -0
  138. spotifywebapipython-1.0.242.dist-info/top_level.txt +1 -0
@@ -0,0 +1,282 @@
1
+ # external package imports.
2
+
3
+ # our package imports.
4
+ from ..sautils import export
5
+ from .artistinfotourevent import ArtistInfoTourEvent
6
+
7
+ @export
8
+ class ArtistInfo:
9
+ """
10
+ Artist Information About object.
11
+ """
12
+
13
+ def __init__(self, id:str, name:str, typeValue:str, uri:str, imageUrlDefault:str) -> None:
14
+ """
15
+ Initializes a new instance of the class.
16
+
17
+ Args:
18
+ id (str):
19
+ The Spotify ID for the artist.
20
+ name (str):
21
+ The name of the artist.
22
+ typeValue (str):
23
+ The object type.
24
+ uri (str):
25
+ The Spotify URI for the artist.
26
+ imageUrlDefault (str):
27
+ Image url of the artist, if defined
28
+ """
29
+ self._AboutUrlFacebook:str = None
30
+ self._AboutUrlInstagram:str = None
31
+ self._AboutUrlTwitter:str = None
32
+ self._AboutUrlWikipedia:str = None
33
+ self._Bio:str = None
34
+ self._BioHtml:str = None
35
+ self._Id:int = id
36
+ self._ImageUrl:str = None
37
+ self._ImageUrlDefault:str = imageUrlDefault
38
+ self._MonthlyListeners:int = None
39
+ self._Name:str = name
40
+ self._TourEvents:list[ArtistInfoTourEvent] = []
41
+ self._Type:str = typeValue
42
+ self._Uri:str = uri
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 AboutUrlFacebook(self) -> str:
55
+ """
56
+ URL link to artist Facebook page, if supplied; otherwise, null.
57
+ """
58
+ return self._AboutUrlFacebook
59
+
60
+ @AboutUrlFacebook.setter
61
+ def AboutUrlFacebook(self, value:str):
62
+ """
63
+ Sets the AboutUrlFacebook property value.
64
+ """
65
+ if isinstance(value, str):
66
+ self._AboutUrlFacebook = value
67
+
68
+
69
+ @property
70
+ def AboutUrlInstagram(self) -> str:
71
+ """
72
+ URL link to artist Instagram page, if supplied; otherwise, null.
73
+ """
74
+ return self._AboutUrlInstagram
75
+
76
+ @AboutUrlInstagram.setter
77
+ def AboutUrlInstagram(self, value:str):
78
+ """
79
+ Sets the AboutUrlInstagram property value.
80
+ """
81
+ if isinstance(value, str):
82
+ self._AboutUrlInstagram = value
83
+
84
+
85
+ @property
86
+ def AboutUrlTwitter(self) -> str:
87
+ """
88
+ URL link to artist Twitter page, if supplied; otherwise, null.
89
+ """
90
+ return self._AboutUrlTwitter
91
+
92
+ @AboutUrlTwitter.setter
93
+ def AboutUrlTwitter(self, value:str):
94
+ """
95
+ Sets the AboutUrlTwitter property value.
96
+ """
97
+ if isinstance(value, str):
98
+ self._AboutUrlTwitter = value
99
+
100
+
101
+ @property
102
+ def AboutUrlWikipedia(self) -> str:
103
+ """
104
+ URL link to artist Wikipedia page, if supplied; otherwise, null.
105
+ """
106
+ return self._AboutUrlWikipedia
107
+
108
+ @AboutUrlWikipedia.setter
109
+ def AboutUrlWikipedia(self, value:str):
110
+ """
111
+ Sets the AboutUrlWikipedia property value.
112
+ """
113
+ if isinstance(value, str):
114
+ self._AboutUrlWikipedia = value
115
+
116
+
117
+ @property
118
+ def Bio(self) -> str:
119
+ """
120
+ Biography text, in plain-text format.
121
+ """
122
+ return self._Bio
123
+
124
+ @Bio.setter
125
+ def Bio(self, value:str):
126
+ """
127
+ Sets the Bio property value.
128
+ """
129
+ if isinstance(value, str):
130
+ self._Bio = value
131
+
132
+
133
+ @property
134
+ def BioHtml(self) -> str:
135
+ """
136
+ Biography text, in html format.
137
+ """
138
+ return self._BioHtml
139
+
140
+ @BioHtml.setter
141
+ def BioHtml(self, value:str):
142
+ """
143
+ Sets the BioHtml property value.
144
+ """
145
+ if isinstance(value, str):
146
+ self._BioHtml = value
147
+
148
+
149
+ @property
150
+ def Id(self) -> str:
151
+ """
152
+ The Spotify ID for the artist.
153
+ """
154
+ return self._Id
155
+
156
+
157
+ @property
158
+ def ImageUrl(self) -> str:
159
+ """
160
+ Image url of the artist, if defined; otheriwse, the `ImageUrlDefault` url value.
161
+ """
162
+ if (self._ImageUrl is not None) and (len(self._ImageUrl.strip()) > 0):
163
+ return self._ImageUrl
164
+ return self._ImageUrlDefault
165
+
166
+ @ImageUrl.setter
167
+ def ImageUrl(self, value:str):
168
+ """
169
+ Sets the ImageUrl property value.
170
+ """
171
+ if isinstance(value, str):
172
+ self._ImageUrl = value
173
+
174
+
175
+ @property
176
+ def ImageUrlDefault(self) -> str:
177
+ """
178
+ Default Image url of the artist, if defined; otherwise, null.
179
+ """
180
+ return self._ImageUrlDefault
181
+
182
+
183
+ @property
184
+ def MonthlyListeners(self) -> int:
185
+ """
186
+ Monthly Listeners text.
187
+ """
188
+ return self._MonthlyListeners
189
+
190
+ @MonthlyListeners.setter
191
+ def MonthlyListeners(self, value:int):
192
+ """
193
+ Sets the MonthlyListeners property value.
194
+ """
195
+ if isinstance(value, int):
196
+ self._MonthlyListeners = value
197
+
198
+
199
+ @property
200
+ def Name(self) -> str:
201
+ """
202
+ The name of the artist.
203
+ """
204
+ return self._Name
205
+
206
+
207
+ @property
208
+ def TourEvents(self) -> list[ArtistInfoTourEvent]:
209
+ """
210
+ An array of `ArtistInfoTourEvent` objects, if the artist has any upcoming tour
211
+ dates on file; otherwise, an empty list.
212
+ """
213
+ return self._TourEvents
214
+
215
+
216
+ @property
217
+ def Type(self) -> str:
218
+ """
219
+ The object type: `artist`.
220
+ """
221
+ return self._Type
222
+
223
+
224
+ @property
225
+ def Uri(self) -> str:
226
+ """
227
+ The Spotify URI for the artist.
228
+ """
229
+ return self._Uri
230
+
231
+
232
+ def ToDictionary(self) -> dict:
233
+ """
234
+ Returns a dictionary representation of the class.
235
+ """
236
+ result:dict = \
237
+ {
238
+ 'about_url_facebook': self._AboutUrlFacebook,
239
+ 'about_url_instagram': self._AboutUrlInstagram,
240
+ 'about_url_twitter': self._AboutUrlTwitter,
241
+ 'about_url_wikipedia': self._AboutUrlWikipedia,
242
+ 'bio': self._Bio,
243
+ 'bio_html': self._BioHtml,
244
+ 'id': self._Id,
245
+ 'image_url': self._ImageUrl,
246
+ 'image_url_default': self._ImageUrlDefault,
247
+ 'name': self._Name,
248
+ 'monthly_listeners': self._MonthlyListeners,
249
+ 'tour_events': [ item.ToDictionary() for item in self._TourEvents ],
250
+ 'type': self._Type,
251
+ 'uri': self._Uri,
252
+ }
253
+ return result
254
+
255
+
256
+ def ToString(self, includeTitle:bool=True) -> str:
257
+ """
258
+ Returns a displayable string representation of the class.
259
+
260
+ Args:
261
+ includeTitle (str):
262
+ True to include the class name title prefix.
263
+ """
264
+ msg:str = ''
265
+ if includeTitle:
266
+ msg = 'ArtistInfo:'
267
+
268
+ if self._Name is not None: msg = '%s\n Name="%s"' % (msg, str(self._Name))
269
+ if self._Uri is not None: msg = '%s\n Uri="%s"' % (msg, str(self._Uri))
270
+ if self._AboutUrlFacebook is not None: msg = '%s\n AboutUrlFacebook="%s"' % (msg, str(self._AboutUrlFacebook))
271
+ if self._AboutUrlInstagram is not None: msg = '%s\n AboutUrlInstagram="%s"' % (msg, str(self._AboutUrlInstagram))
272
+ if self._AboutUrlTwitter is not None: msg = '%s\n AboutUrlTwitter="%s"' % (msg, str(self._AboutUrlTwitter))
273
+ if self._AboutUrlWikipedia is not None: msg = '%s\n AboutUrlWikipedia="%s"' % (msg, str(self._AboutUrlWikipedia))
274
+ if self._Bio is not None: msg = '%s\n Bio="%s"' % (msg, str(self._Bio))
275
+ if self._BioHtml is not None: msg = '%s\n BioHtml="%s"' % (msg, str(self._BioHtml))
276
+ if self._Id is not None: msg = '%s\n Id="%s"' % (msg, str(self._Id))
277
+ if self._ImageUrl is not None: msg = '%s\n ImageUrl="%s"' % (msg, str(self._ImageUrl))
278
+ if self._ImageUrlDefault is not None: msg = '%s\n ImageUrlDefault="%s"' % (msg, str(self._ImageUrlDefault))
279
+ if self._MonthlyListeners is not None: msg = '%s\n MonthlyListeners="%s"' % (msg, str(self._MonthlyListeners))
280
+ msg = '%s\n TourEvents Count="%d"' % (msg, len(self._TourEvents))
281
+ if self._Type is not None: msg = '%s\n Type="%s"' % (msg, str(self._Type))
282
+ return msg
@@ -0,0 +1,127 @@
1
+ # external package imports.
2
+ from datetime import datetime
3
+
4
+ # our package imports.
5
+ from ..sautils import export
6
+
7
+ @export
8
+ class ArtistInfoTourEvent:
9
+ """
10
+ Artist Information Tour object.
11
+ """
12
+
13
+ def __init__(self) -> None:
14
+ """
15
+ Initializes a new instance of the class.
16
+ """
17
+ self._EventDateTime:str = None
18
+ self._Href:str = None
19
+ self._Title:str = None
20
+ self._VenueName:str = None
21
+
22
+
23
+ def __repr__(self) -> str:
24
+ return self.ToString()
25
+
26
+
27
+ def __str__(self) -> str:
28
+ return self.ToString()
29
+
30
+
31
+ @property
32
+ def EventDateTime(self) -> datetime:
33
+ """
34
+ Date and time the tour event starts in the local timezone of the
35
+ venue location, if supplied; otherwise, null.
36
+ """
37
+ return self._EventDateTime
38
+
39
+ @EventDateTime.setter
40
+ def EventDateTime(self, value:datetime):
41
+ """
42
+ Sets the EventDateTime property value.
43
+ """
44
+ if value is None or isinstance(value, datetime):
45
+ self._EventDateTime = value
46
+
47
+
48
+ @property
49
+ def Href(self) -> str:
50
+ """
51
+ Link to the concert information, if supplied; otherwise, null.
52
+ """
53
+ return self._Href
54
+
55
+ @Href.setter
56
+ def Href(self, value:str):
57
+ """
58
+ Sets the Href property value.
59
+ """
60
+ if isinstance(value, str):
61
+ self._Href = value
62
+
63
+
64
+ @property
65
+ def Title(self) -> str:
66
+ """
67
+ Title given to the event by the promoter, if supplied; otherwise, null.
68
+ """
69
+ return self._Title
70
+
71
+ @Title.setter
72
+ def Title(self, value:str):
73
+ """
74
+ Sets the Title property value.
75
+ """
76
+ if isinstance(value, str):
77
+ self._Title = value
78
+
79
+
80
+ @property
81
+ def VenueName(self) -> str:
82
+ """
83
+ The venue name of where the event will take place, if supplied; otherwise, null.
84
+ """
85
+ return self._VenueName
86
+
87
+ @VenueName.setter
88
+ def VenueName(self, value:str):
89
+ """
90
+ Sets the VenueName property value.
91
+ """
92
+ if isinstance(value, str):
93
+ self._VenueName = value
94
+
95
+
96
+ def ToDictionary(self) -> dict:
97
+ """
98
+ Returns a dictionary representation of the class.
99
+ """
100
+ result:dict = \
101
+ {
102
+ 'title': self._Title,
103
+ 'venue_name': self._VenueName,
104
+ 'href': self._Href,
105
+ }
106
+ if self._EventDateTime is not None:
107
+ result['event_datetime'] = self._EventDateTime.isoformat()
108
+ return result
109
+
110
+
111
+ def ToString(self, includeTitle:bool=True) -> str:
112
+ """
113
+ Returns a displayable string representation of the class.
114
+
115
+ Args:
116
+ includeTitle (str):
117
+ True to include the class name title prefix.
118
+ """
119
+ msg:str = ''
120
+ if includeTitle:
121
+ msg = 'ArtistInfoTourEvent:'
122
+
123
+ if self._EventDateTime is not None: msg = '%s\n EventDateTime="%s"' % (msg, self._EventDateTime.isoformat())
124
+ if self._Title is not None: msg = '%s\n Title="%s"' % (msg, str(self._Title))
125
+ if self._VenueName is not None: msg = '%s\n VenueName="%s"' % (msg, str(self._VenueName))
126
+ if self._Href is not None: msg = '%s\n Href="%s"' % (msg, str(self._Href))
127
+ return msg
@@ -0,0 +1,70 @@
1
+ # external package imports.
2
+
3
+ # our package imports.
4
+ from ..sautils import export
5
+ from .artist import Artist
6
+ from .pageobject import PageObject
7
+
8
+ @export
9
+ class ArtistPage(PageObject):
10
+ """
11
+ Spotify Web API ArtistPage object.
12
+
13
+ This allows for multiple pages of `Artist` 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[Artist] = []
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(Artist(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[Artist]:
55
+ """
56
+ Array of `Artist` objects.
57
+ """
58
+ return self._Items
59
+
60
+
61
+ def ToString(self, includeItems:bool=False) -> str:
62
+ """
63
+ Returns a displayable string representation of the class.
64
+
65
+ Args:
66
+ includeItems (bool):
67
+ True to include the Items collection of objects; otherwise, False
68
+ to only return base properties.
69
+ """
70
+ return 'ArtistPage: %s' % super().ToString(includeItems)
@@ -0,0 +1,163 @@
1
+ # external package imports.
2
+
3
+ # our package imports.
4
+ from ..sautils import export
5
+ from .externalurls import ExternalUrls
6
+
7
+ @export
8
+ class ArtistSimplified:
9
+ """
10
+ Spotify Web API SimplifiedArtist object.
11
+ """
12
+
13
+ def __init__(self, root:dict=None) -> None:
14
+ """
15
+ Initializes a new instance of the class.
16
+
17
+ Args:
18
+ root (dict):
19
+ Spotify Web API JSON response in dictionary format, used to load object
20
+ attributes; otherwise, None to not load attributes.
21
+ """
22
+ self._ExternalUrls:ExternalUrls = None
23
+ self._Href:str = None
24
+ self._Id:int = None
25
+ self._Name:str = None
26
+ self._Type:str = None
27
+ self._Uri:str = None
28
+
29
+ if (root is None):
30
+
31
+ pass
32
+
33
+ else:
34
+
35
+ self._Href = root.get('href', None)
36
+ self._Id = root.get('id', None)
37
+ self._Name = root.get('name', None)
38
+ self._Type = root.get('type', None)
39
+ self._Uri = root.get('uri', None)
40
+
41
+ # process all collections and objects.
42
+ item:dict = root.get('external_urls',None)
43
+ if item is not None:
44
+ self._ExternalUrls = ExternalUrls(root=item)
45
+
46
+
47
+ def __repr__(self) -> str:
48
+ return self.ToString()
49
+
50
+
51
+ def __str__(self) -> str:
52
+ return self.ToString()
53
+
54
+
55
+ # implement sorting support.
56
+ def __eq__(self, other):
57
+ try:
58
+ return self.Name == other.Name
59
+ except Exception:
60
+ if (isinstance(self, ArtistSimplified )) and (isinstance(other, ArtistSimplified )):
61
+ return self.Name == other.Name
62
+ return False
63
+
64
+ def __lt__(self, other):
65
+ try:
66
+ return self.Name < other.Name
67
+ except Exception:
68
+ if (isinstance(self, ArtistSimplified )) and (isinstance(other, ArtistSimplified )):
69
+ return self.Name < other.Name
70
+ return False
71
+
72
+
73
+ @property
74
+ def ExternalUrls(self) -> list:
75
+ """
76
+ Known external URLs for this artist.
77
+ """
78
+ return self._ExternalUrls
79
+
80
+
81
+ @property
82
+ def Href(self) -> str:
83
+ """
84
+ A link to the Web API endpoint providing full details of the artist.
85
+ """
86
+ return self._Href
87
+
88
+
89
+ @property
90
+ def Id(self) -> str:
91
+ """
92
+ The Spotify ID for the artist.
93
+
94
+ Example: `2CIMQHirSU0MQqyYHq0eOx`
95
+ """
96
+ return self._Id
97
+
98
+
99
+ @property
100
+ def Name(self) -> str:
101
+ """
102
+ The name of the artist.
103
+ """
104
+ return self._Name
105
+
106
+
107
+ @property
108
+ def Type(self) -> str:
109
+ """
110
+ The object type: `artist`.
111
+ """
112
+ return self._Type
113
+
114
+
115
+ @property
116
+ def Uri(self) -> str:
117
+ """
118
+ The Spotify URI for the artist.
119
+
120
+ Example: `spotify:artist:2CIMQHirSU0MQqyYHq0eOx`
121
+ """
122
+ return self._Uri
123
+
124
+
125
+ def ToDictionary(self) -> dict:
126
+ """
127
+ Returns a dictionary representation of the class.
128
+ """
129
+ externalUrls:dict = {}
130
+ if self._ExternalUrls is not None:
131
+ externalUrls = self._ExternalUrls.ToDictionary()
132
+
133
+ result:dict = \
134
+ {
135
+ 'external_urls': externalUrls,
136
+ 'href': self._Href,
137
+ 'id': self._Id,
138
+ 'name': self._Name,
139
+ 'type': self._Type,
140
+ 'uri': self._Uri,
141
+ }
142
+ return result
143
+
144
+
145
+ def ToString(self, includeTitle:bool=True) -> str:
146
+ """
147
+ Returns a displayable string representation of the class.
148
+
149
+ Args:
150
+ includeTitle (str):
151
+ True to include the class name title prefix.
152
+ """
153
+ msg:str = ''
154
+ if includeTitle:
155
+ msg = 'Artist:'
156
+
157
+ if self._Name is not None: msg = '%s\n Name="%s"' % (msg, str(self._Name))
158
+ if self._Uri is not None: msg = '%s\n Uri="%s"' % (msg, str(self._Uri))
159
+ if self._ExternalUrls is not None: msg = '%s\n %s' % (msg, str(self._ExternalUrls))
160
+ if self._Href is not None: msg = '%s\n Href="%s"' % (msg, str(self._Href))
161
+ if self._Id is not None: msg = '%s\n Id="%s"' % (msg, str(self._Id))
162
+ if self._Type is not None: msg = '%s\n Type="%s"' % (msg, str(self._Type))
163
+ return msg