spotifywebapiPython 1.0.285__py3-none-any.whl → 1.0.287__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 (24) hide show
  1. spotifywebapipython/const.py +1 -1
  2. spotifywebapipython/docs/__init__.html +14 -2
  3. spotifywebapipython/docs/index.html +2 -2
  4. spotifywebapipython/docs/search.js +1 -1
  5. spotifywebapipython/docs/spotifywebapipython/const.html +3 -3
  6. spotifywebapipython/docs/spotifywebapipython/saappmessages.html +2 -2
  7. spotifywebapipython/docs/spotifywebapipython/sautils.html +2 -2
  8. spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +2 -2
  9. spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +2 -2
  10. spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +2 -2
  11. spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +22 -8
  12. spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +2 -2
  13. spotifywebapipython/docs/spotifywebapipython/spotifymediatypes.html +2 -2
  14. spotifywebapipython/docs/spotifywebapipython/spotifytypeprefixes.html +2 -2
  15. spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +2 -2
  16. spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +2 -2
  17. spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +2 -2
  18. spotifywebapipython/models/searchresponse.py +107 -4
  19. spotifywebapipython/spotifyclient.py +197 -15
  20. {spotifywebapipython-1.0.285.dist-info → spotifywebapipython-1.0.287.dist-info}/METADATA +1 -1
  21. {spotifywebapipython-1.0.285.dist-info → spotifywebapipython-1.0.287.dist-info}/RECORD +24 -24
  22. {spotifywebapipython-1.0.285.dist-info → spotifywebapipython-1.0.287.dist-info}/LICENSE +0 -0
  23. {spotifywebapipython-1.0.285.dist-info → spotifywebapipython-1.0.287.dist-info}/WHEEL +0 -0
  24. {spotifywebapipython-1.0.285.dist-info → spotifywebapipython-1.0.287.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,7 @@
9
9
  </title>
10
10
  <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/>
11
11
  <!-- build env - Package Name = "spotifywebapipython" -->
12
- <!-- build env - Package Version = "1.0.285" -->
12
+ <!-- build env - Package Version = "1.0.287" -->
13
13
  <!-- pdoc module.modulename = "spotifywebapipython.spotifywebplayertoken" -->
14
14
  <!-- pdoc module.is_package = "False" -->
15
15
  <!-- pdoc root_module_name = "None" -->
@@ -101,7 +101,7 @@
101
101
 
102
102
  <footer class="footertext">
103
103
  spotifywebapipython</br>
104
- Version 1.0.285</br>
104
+ Version 1.0.287</br>
105
105
  <a href="https://developer.spotify.com/documentation/web-api" target="_blank">
106
106
  <img src="../spotifywebapipython.ico" alt="brand icon" style="width:32px; height:32px; padding:4px;"/>
107
107
  A Spotify Web Api Client
@@ -2,14 +2,18 @@
2
2
 
3
3
  # our package imports.
4
4
  from ..sautils import export
5
- from .albumpagesimplified import AlbumPageSimplified
6
- from .artistpage import ArtistPage
7
- from .audiobookpagesimplified import AudiobookPageSimplified
5
+ from .albumpagesaved import AlbumPageSaved, AlbumSaved
6
+ from .albumpagesimplified import AlbumPageSimplified, AlbumSimplified
7
+ from .artistpage import ArtistPage, Artist
8
+ from .audiobookpagesimplified import AudiobookPageSimplified, AudiobookSimplified
8
9
  from .episodepagesimplified import EpisodePageSimplified
10
+ from .playhistorypage import PlayHistoryPage, PlayHistory
9
11
  from .playlistpagesimplified import PlaylistPageSimplified
10
12
  from .playlistsimplified import PlaylistSimplified
13
+ from .showpagesaved import ShowPageSaved, ShowSaved
11
14
  from .showpagesimplified import ShowPageSimplified
12
- from .trackpage import TrackPage
15
+ from .trackpage import TrackPage, Track
16
+ from .trackpagesaved import TrackPageSaved, TrackSaved
13
17
 
14
18
  @export
15
19
  class SearchResponse:
@@ -313,6 +317,105 @@ class SearchResponse:
313
317
 
314
318
  # return to caller.
315
319
  return result
320
+
321
+
322
+ def LoadAlbumsFromAlbumPageSaved(self, pageObj:AlbumPageSaved) -> None:
323
+ """
324
+ Adds the album items contained in a `AlbumPageSaved` object to the Albums collection.
325
+ """
326
+ if (isinstance(pageObj, AlbumPageSaved)):
327
+
328
+ item:AlbumSaved
329
+ for item in pageObj.Items:
330
+ self._Albums.Items.append(item.Album)
331
+
332
+
333
+ def LoadAlbumsFromAlbumPageSimplified(self, pageObj:AlbumPageSimplified) -> None:
334
+ """
335
+ Adds the album items contained in a `AlbumPageSimplified` object to the Albums collection.
336
+ """
337
+ if (isinstance(pageObj, AlbumPageSimplified)):
338
+
339
+ item:AlbumSimplified
340
+ for item in pageObj.Items:
341
+ self._Albums.Items.append(item)
342
+
343
+
344
+ def LoadArtistsFromArtistPage(self, pageObj:ArtistPage) -> None:
345
+ """
346
+ Adds the artist items contained in a `ArtistPage` object to the Artists collection.
347
+ """
348
+ if (isinstance(pageObj, ArtistPage)):
349
+
350
+ item:Artist
351
+ for item in pageObj.Items:
352
+ self._Artists.Items.append(item)
353
+
354
+
355
+ def LoadAudiobooksFromAudiobookPageSimplified(self, pageObj:AudiobookPageSimplified) -> None:
356
+ """
357
+ Adds the audiobook items contained in a `AudiobookPageSimplified` object to the Audiobooks collection.
358
+ """
359
+ if (isinstance(pageObj, AudiobookPageSimplified)):
360
+
361
+ item:AudiobookSimplified
362
+ for item in pageObj.Items:
363
+ self._Audiobooks.Items.append(item)
364
+
365
+
366
+ def LoadPlaylistsFromPlaylistPageSimplified(self, pageObj:PlaylistPageSimplified) -> None:
367
+ """
368
+ Adds the playlist items contained in a `PlaylistPageSimplified` object to the Playlists collection.
369
+ """
370
+ if (isinstance(pageObj, PlaylistPageSimplified)):
371
+
372
+ item:PlaylistSimplified
373
+ for item in pageObj.Items:
374
+ self._Playlists.Items.append(item)
375
+
376
+
377
+ def LoadShowsFromShowPageSaved(self, pageObj:ShowPageSaved) -> None:
378
+ """
379
+ Adds the show items contained in a `ShowPageSaved` object to the Shows collection.
380
+ """
381
+ if (isinstance(pageObj, ShowPageSaved)):
382
+
383
+ item:ShowSaved
384
+ for item in pageObj.Items:
385
+ self._Shows.Items.append(item.Show)
386
+
387
+
388
+ def LoadTracksFromPlayHistoryPage(self, pageObj:PlayHistoryPage) -> None:
389
+ """
390
+ Adds the track items contained in a `PlayHistoryPage` object to the Tracks collection.
391
+ """
392
+ if (isinstance(pageObj, PlayHistoryPage)):
393
+
394
+ item:PlayHistory
395
+ for item in pageObj.Items:
396
+ self._Tracks.Items.append(item.Track)
397
+
398
+
399
+ def LoadTracksFromTrackPageSaved(self, pageObj:TrackPageSaved) -> None:
400
+ """
401
+ Adds the track items contained in a `TrackPageSaved` object to the Tracks collection.
402
+ """
403
+ if (isinstance(pageObj, TrackPageSaved)):
404
+
405
+ item:TrackSaved
406
+ for item in pageObj.Items:
407
+ self._Tracks.Items.append(item.Track)
408
+
409
+
410
+ def LoadTracksFromTrackPage(self, pageObj:TrackPage) -> None:
411
+ """
412
+ Adds the track items contained in a `TrackPage` object to the Tracks collection.
413
+ """
414
+ if (isinstance(pageObj, TrackPage)):
415
+
416
+ item:Track
417
+ for item in pageObj.Items:
418
+ self._Tracks.Items.append(item)
316
419
 
317
420
 
318
421
  def ToDictionary(self) -> dict:
@@ -3822,7 +3822,7 @@ class SpotifyClient:
3822
3822
  result.Total = pageObj.Total
3823
3823
  result.DateLastRefreshed = datetime.utcnow().timestamp()
3824
3824
 
3825
- # sort result items.
3825
+ # any results to process?
3826
3826
  if (len(result.Items) > 0):
3827
3827
 
3828
3828
  # sort result items.
@@ -3873,6 +3873,7 @@ class SpotifyClient:
3873
3873
  country:str=None,
3874
3874
  limitTotal:int=None,
3875
3875
  sortResult:bool=True,
3876
+ filterCriteria:str|None=None,
3876
3877
  ) -> AlbumPageSimplified:
3877
3878
  """
3878
3879
  <span class="deprecated">
@@ -3910,6 +3911,9 @@ class SpotifyClient:
3910
3911
  True to sort the items by name; otherwise, False to leave the items in the same order they
3911
3912
  were returned in by the Spotify Web API.
3912
3913
  Default: True
3914
+ filterCriteria (str):
3915
+ Filter returned entries by a album name or uri value.
3916
+ Value can be a full name (e.g. "My Album Name"), or a partial name (e.g. "My").
3913
3917
 
3914
3918
  Returns:
3915
3919
  An `AlbumPageSimplified` object that contains simplified album information.
@@ -3947,6 +3951,7 @@ class SpotifyClient:
3947
3951
  apiMethodParms.AppendKeyValue("country", country)
3948
3952
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
3949
3953
  apiMethodParms.AppendKeyValue("sortResult", sortResult)
3954
+ apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
3950
3955
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of new album releases", apiMethodParms)
3951
3956
 
3952
3957
  # are spotify web player credentials configured? if so, then we will use them to create
@@ -4021,11 +4026,30 @@ class SpotifyClient:
4021
4026
  result.Total = pageObj.Total
4022
4027
  result.DateLastRefreshed = datetime.utcnow().timestamp()
4023
4028
 
4024
- # sort result items.
4029
+ # any results to process?
4025
4030
  if (len(result.Items) > 0):
4031
+
4032
+ # sort result items.
4026
4033
  if (sortResult is True):
4027
4034
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
4028
4035
 
4036
+ # apply filter criteria (if specified).
4037
+ if (filterCriteria is not None):
4038
+ _logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
4039
+ filterCriteriaCompare:str = (filterCriteria or "").lower()
4040
+ isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
4041
+ # process list in reverse order since we are removing items.
4042
+ for idx in reversed(range(len(result.Items))):
4043
+ item:AlbumSimplified = result.Items[idx]
4044
+ itemFound:bool = False
4045
+ if (isFilterUri):
4046
+ if ((item.Uri or "").lower() == filterCriteriaCompare):
4047
+ itemFound = True
4048
+ elif ((item.Name or "").lower().find(filterCriteriaCompare) > -1):
4049
+ itemFound = True
4050
+ if (not itemFound):
4051
+ result.Items.pop(idx)
4052
+
4029
4053
  # trace.
4030
4054
  _logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
4031
4055
  return result
@@ -4575,8 +4599,10 @@ class SpotifyClient:
4575
4599
  result.Total = pageObj.Total
4576
4600
  result.DateLastRefreshed = datetime.utcnow().timestamp()
4577
4601
 
4578
- # sort result items.
4602
+ # any results to process?
4579
4603
  if (len(result.Items) > 0):
4604
+
4605
+ # sort result items.
4580
4606
  if (sortResult is True):
4581
4607
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
4582
4608
 
@@ -5140,6 +5166,7 @@ class SpotifyClient:
5140
5166
  limit:int=20,
5141
5167
  limitTotal:int=None,
5142
5168
  sortResult:bool=True,
5169
+ filterCriteria:str|None=None,
5143
5170
  ) -> ArtistPage:
5144
5171
  """
5145
5172
  Get the current user's followed artists.
@@ -5163,6 +5190,9 @@ class SpotifyClient:
5163
5190
  True to sort the items by name; otherwise, False to leave the items in the same order they
5164
5191
  were returned in by the Spotify Web API.
5165
5192
  Default: True
5193
+ filterCriteria (str):
5194
+ Filter returned entries by a audiobook name or uri value.
5195
+ Value can be a full name (e.g. "My AudioBook Name"), or a partial name (e.g. "My").
5166
5196
 
5167
5197
  Returns:
5168
5198
  An `ArtistPage` object of matching results.
@@ -5199,6 +5229,7 @@ class SpotifyClient:
5199
5229
  apiMethodParms.AppendKeyValue("limit", limit)
5200
5230
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
5201
5231
  apiMethodParms.AppendKeyValue("sortResult", sortResult)
5232
+ apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
5202
5233
  _logsi.LogMethodParmList(SILevel.Verbose, "Get the current user's followed artists", apiMethodParms)
5203
5234
 
5204
5235
  # validations.
@@ -5274,11 +5305,30 @@ class SpotifyClient:
5274
5305
  result.CursorAfter = pageObj.CursorAfter
5275
5306
  result.DateLastRefreshed = datetime.utcnow().timestamp()
5276
5307
 
5277
- # sort result items.
5308
+ # any results to process?
5278
5309
  if (len(result.Items) > 0):
5310
+
5311
+ # sort result items.
5279
5312
  if (sortResult is True):
5280
5313
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
5281
5314
 
5315
+ # apply filter criteria (if specified).
5316
+ if (filterCriteria is not None):
5317
+ _logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
5318
+ filterCriteriaCompare:str = (filterCriteria or "").lower()
5319
+ isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
5320
+ # process list in reverse order since we are removing items.
5321
+ for idx in reversed(range(len(result.Items))):
5322
+ item:Artist = result.Items[idx]
5323
+ itemFound:bool = False
5324
+ if (isFilterUri):
5325
+ if ((item.Uri or "").lower() == filterCriteriaCompare):
5326
+ itemFound = True
5327
+ elif ((item.Name or "").lower().find(filterCriteriaCompare) > -1):
5328
+ itemFound = True
5329
+ if (not itemFound):
5330
+ result.Items.pop(idx)
5331
+
5282
5332
  # trace.
5283
5333
  _logsi.LogObject(SILevel.Verbose, TRACE_METHOD_RESULT_TYPE % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
5284
5334
  return result
@@ -5302,6 +5352,7 @@ class SpotifyClient:
5302
5352
  artistId:str=None,
5303
5353
  market:str=None,
5304
5354
  sortResult:bool=True,
5355
+ filterCriteria:str|None=None,
5305
5356
  ) -> list[Track]:
5306
5357
  """
5307
5358
  <span class="deprecated">
@@ -5843,7 +5894,7 @@ class SpotifyClient:
5843
5894
  result.Total = pageObj.Total
5844
5895
  result.DateLastRefreshed = datetime.utcnow().timestamp()
5845
5896
 
5846
- # sort result items.
5897
+ # any results to process?
5847
5898
  if (len(result.Items) > 0):
5848
5899
 
5849
5900
  # sort result items.
@@ -6308,8 +6359,10 @@ class SpotifyClient:
6308
6359
  result.Total = pageObj.Total
6309
6360
  result.DateLastRefreshed = datetime.utcnow().timestamp()
6310
6361
 
6311
- # sort result items.
6362
+ # any results to process?
6312
6363
  if (len(result.Items) > 0):
6364
+
6365
+ # sort result items.
6313
6366
  if (sortResult is True):
6314
6367
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
6315
6368
 
@@ -6617,8 +6670,10 @@ class SpotifyClient:
6617
6670
  result.Total = pageObj.Total
6618
6671
  result.DateLastRefreshed = datetime.utcnow().timestamp()
6619
6672
 
6620
- # sort result items.
6673
+ # any results to process?
6621
6674
  if (len(result.Items) > 0):
6675
+
6676
+ # sort result items.
6622
6677
  if (sortResult is True):
6623
6678
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
6624
6679
 
@@ -7351,7 +7406,7 @@ class SpotifyClient:
7351
7406
  result.Total = pageObj.Total
7352
7407
  result.DateLastRefreshed = datetime.utcnow().timestamp()
7353
7408
 
7354
- # sort result items.
7409
+ # any results to process?
7355
7410
  if (len(result.Items) > 0):
7356
7411
 
7357
7412
  # sort result items.
@@ -7690,8 +7745,10 @@ class SpotifyClient:
7690
7745
  result.Total = pageObj.Total
7691
7746
  result.DateLastRefreshed = datetime.utcnow().timestamp()
7692
7747
 
7693
- # sort result items.
7748
+ # any results to process?
7694
7749
  if (len(result.Items) > 0):
7750
+
7751
+ # sort result items.
7695
7752
  if (sortResult is True):
7696
7753
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
7697
7754
 
@@ -9295,7 +9352,8 @@ class SpotifyClient:
9295
9352
  limit:int=50,
9296
9353
  after:int=None,
9297
9354
  before:int=None,
9298
- limitTotal:int=None
9355
+ limitTotal:int=None,
9356
+ filterCriteria:str|None=None,
9299
9357
  ) -> PlayHistoryPage:
9300
9358
  """
9301
9359
  Get tracks from the current user's recently played tracks.
@@ -9326,6 +9384,9 @@ class SpotifyClient:
9326
9384
  and paging is automatically used to retrieve all available items up to the
9327
9385
  maximum number specified.
9328
9386
  Default: None (disabled)
9387
+ filterCriteria (str):
9388
+ Filter returned entries by a track name or uri value.
9389
+ Value can be a full name (e.g. "My Track Name"), or a partial name (e.g. "My").
9329
9390
 
9330
9391
  Spotify currently limits the maximum number of items returned to 50 no matter what you
9331
9392
  supply for the `limitTotal` argument.
@@ -9371,6 +9432,7 @@ class SpotifyClient:
9371
9432
  apiMethodParms.AppendKeyValue("after", after)
9372
9433
  apiMethodParms.AppendKeyValue("before", before)
9373
9434
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
9435
+ apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
9374
9436
  _logsi.LogMethodParmList(SILevel.Verbose, "Get tracks from the current user's recently played tracks", apiMethodParms)
9375
9437
 
9376
9438
  # validations.
@@ -9460,6 +9522,26 @@ class SpotifyClient:
9460
9522
  result.CursorBefore = pageObj.CursorBefore
9461
9523
  result.DateLastRefreshed = datetime.utcnow().timestamp()
9462
9524
 
9525
+ # any results to process?
9526
+ if (len(result.Items) > 0):
9527
+
9528
+ # apply filter criteria (if specified).
9529
+ if (filterCriteria is not None):
9530
+ _logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
9531
+ filterCriteriaCompare:str = (filterCriteria or "").lower()
9532
+ isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
9533
+ # process list in reverse order since we are removing items.
9534
+ for idx in reversed(range(len(result.Items))):
9535
+ item:PlayHistory = result.Items[idx]
9536
+ itemFound:bool = False
9537
+ if (isFilterUri):
9538
+ if ((item.Track.Uri or "").lower() == filterCriteriaCompare):
9539
+ itemFound = True
9540
+ elif ((item.Track.Name or "").lower().find(filterCriteriaCompare) > -1):
9541
+ itemFound = True
9542
+ if (not itemFound):
9543
+ result.Items.pop(idx)
9544
+
9463
9545
  # trace.
9464
9546
  _logsi.LogObject(SILevel.Verbose, TRACE_METHOD_RESULT_TYPE % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
9465
9547
  return result
@@ -10105,7 +10187,7 @@ class SpotifyClient:
10105
10187
  result.Total = pageObj.Total
10106
10188
  result.DateLastRefreshed = datetime.utcnow().timestamp()
10107
10189
 
10108
- # sort result items.
10190
+ # any results to process?
10109
10191
  if (len(result.Items) > 0):
10110
10192
 
10111
10193
  # sort result items.
@@ -10298,8 +10380,10 @@ class SpotifyClient:
10298
10380
  result.Total = pageObj.Total
10299
10381
  result.DateLastRefreshed = datetime.utcnow().timestamp()
10300
10382
 
10301
- # sort result items.
10383
+ # any results to process?
10302
10384
  if (len(result.Items) > 0):
10385
+
10386
+ # sort result items.
10303
10387
  if (sortResult is True):
10304
10388
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
10305
10389
 
@@ -10769,7 +10853,7 @@ class SpotifyClient:
10769
10853
  result.Total = pageObj.Total
10770
10854
  result.DateLastRefreshed = datetime.utcnow().timestamp()
10771
10855
 
10772
- # sort result items.
10856
+ # any results to process?
10773
10857
  if (len(result.Items) > 0):
10774
10858
 
10775
10859
  # sort result items.
@@ -12679,6 +12763,7 @@ class SpotifyClient:
12679
12763
  offset:int=0,
12680
12764
  limitTotal:int=None,
12681
12765
  sortResult:bool=True,
12766
+ filterCriteria:str|None=None,
12682
12767
  ) -> ArtistPage:
12683
12768
  """
12684
12769
  Get the current user's top artists based on calculated affinity.
@@ -12710,6 +12795,9 @@ class SpotifyClient:
12710
12795
  True to sort the items by name; otherwise, False to leave the items in the same order they
12711
12796
  were returned in by the Spotify Web API.
12712
12797
  Default: True
12798
+ filterCriteria (str):
12799
+ Filter returned entries by a artist name or uri value.
12800
+ Value can be a full name (e.g. "My Artist Name"), or a partial name (e.g. "My").
12713
12801
 
12714
12802
  Returns:
12715
12803
  An `ArtistPage` object of matching results.
@@ -12747,6 +12835,7 @@ class SpotifyClient:
12747
12835
  apiMethodParms.AppendKeyValue("offset", offset)
12748
12836
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
12749
12837
  apiMethodParms.AppendKeyValue("sortResult", sortResult)
12838
+ apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
12750
12839
  _logsi.LogMethodParmList(SILevel.Verbose, "Get the current user's top artists", apiMethodParms)
12751
12840
 
12752
12841
  # validations.
@@ -12816,11 +12905,30 @@ class SpotifyClient:
12816
12905
  result.Total = pageObj.Total
12817
12906
  result.DateLastRefreshed = datetime.utcnow().timestamp()
12818
12907
 
12819
- # sort result items.
12908
+ # any results to process?
12820
12909
  if (len(result.Items) > 0):
12910
+
12911
+ # sort result items.
12821
12912
  if (sortResult is True):
12822
12913
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
12823
12914
 
12915
+ # apply filter criteria (if specified).
12916
+ if (filterCriteria is not None):
12917
+ _logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
12918
+ filterCriteriaCompare:str = (filterCriteria or "").lower()
12919
+ isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
12920
+ # process list in reverse order since we are removing items.
12921
+ for idx in reversed(range(len(result.Items))):
12922
+ item:Artist = result.Items[idx]
12923
+ itemFound:bool = False
12924
+ if (isFilterUri):
12925
+ if ((item.Uri or "").lower() == filterCriteriaCompare):
12926
+ itemFound = True
12927
+ elif ((item.Name or "").lower().find(filterCriteriaCompare) > -1):
12928
+ itemFound = True
12929
+ if (not itemFound):
12930
+ result.Items.pop(idx)
12931
+
12824
12932
  # trace.
12825
12933
  _logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
12826
12934
  return result
@@ -12846,6 +12954,9 @@ class SpotifyClient:
12846
12954
  offset:int=0,
12847
12955
  limitTotal:int=None,
12848
12956
  sortResult:bool=True,
12957
+ filterArtist:str|None=None,
12958
+ filterAlbum:str|None=None,
12959
+ filterCriteria:str|None=None,
12849
12960
  ) -> TrackPage:
12850
12961
  """
12851
12962
  Get the current user's top tracks based on calculated affinity.
@@ -12877,6 +12988,15 @@ class SpotifyClient:
12877
12988
  True to sort the items by name; otherwise, False to leave the items in the same order they
12878
12989
  were returned in by the Spotify Web API.
12879
12990
  Default: True
12991
+ filterArtist (str):
12992
+ Filter returned entries by an artist name or uri value.
12993
+ Value can be the full name of the artist (e.g. "Jeremy Camp"), or a partial name (e.g. "Camp").
12994
+ filterAlbum (str):
12995
+ Filter returned entries by an album name or uri value.
12996
+ Value can be the full name of the album (e.g. "Carried Me"), or a partial name (e.g. "Carried").
12997
+ filterCriteria (str):
12998
+ Filter returned entries by a track name or uri value.
12999
+ Value can be a full name (e.g. "My Track Name"), or a partial name (e.g. "My").
12880
13000
 
12881
13001
  Returns:
12882
13002
  An `TrackPage` object of matching results.
@@ -12914,6 +13034,9 @@ class SpotifyClient:
12914
13034
  apiMethodParms.AppendKeyValue("offset", offset)
12915
13035
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
12916
13036
  apiMethodParms.AppendKeyValue("sortResult", sortResult)
13037
+ apiMethodParms.AppendKeyValue("filterArtist", filterArtist)
13038
+ apiMethodParms.AppendKeyValue("filterAlbum", filterAlbum)
13039
+ apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
12917
13040
  _logsi.LogMethodParmList(SILevel.Verbose, "Get the current user's top tracks", apiMethodParms)
12918
13041
 
12919
13042
  # validations.
@@ -12983,11 +13106,70 @@ class SpotifyClient:
12983
13106
  result.Total = pageObj.Total
12984
13107
  result.DateLastRefreshed = datetime.utcnow().timestamp()
12985
13108
 
12986
- # sort result items.
13109
+ # any results to process?
12987
13110
  if (len(result.Items) > 0):
13111
+
13112
+ # sort result items.
12988
13113
  if (sortResult is True):
12989
13114
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
12990
13115
 
13116
+ # apply artist filter criteria.
13117
+ if (filterArtist is not None):
13118
+ _logsi.LogVerbose("Applying filter criteria to results list: %s=\"%s\"" % ("artist", filterArtist))
13119
+ filterArtistCompare:str = (filterArtist or "").lower()
13120
+ isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterArtistCompare)
13121
+ # process list in reverse order since we are removing items.
13122
+ for idx in reversed(range(len(result.Items))):
13123
+ track:Track = result.Items[idx]
13124
+ artistFound:bool = False
13125
+ artist:ArtistSimplified = None
13126
+ for artist in track.Artists:
13127
+ if (isFilterUri):
13128
+ if ((artist.Uri or "").lower() == filterArtistCompare):
13129
+ artistFound = True
13130
+ break
13131
+ elif ((artist.Name or "").lower().find(filterArtistCompare) > -1):
13132
+ artistFound = True
13133
+ break
13134
+ if (not artistFound):
13135
+ result.Items.pop(idx)
13136
+
13137
+ # apply album filter criteria.
13138
+ if (filterAlbum is not None):
13139
+ _logsi.LogVerbose("Applying filter criteria to results list: %s=\"%s\"" % ("album", filterAlbum))
13140
+ filterAlbumCompare:str = (filterAlbum or "").lower()
13141
+ isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterAlbumCompare)
13142
+ # process list in reverse order since we are removing items.
13143
+ for idx in reversed(range(len(result.Items))):
13144
+ track:Track = result.Items[idx]
13145
+ albumFound:bool = False
13146
+ album:Album = track.Album
13147
+ if (album is not None):
13148
+ if (isFilterUri):
13149
+ if ((album.Uri or "").lower() == filterAlbumCompare):
13150
+ albumFound = True
13151
+ elif ((album.Name or "").lower().find(filterAlbumCompare) > -1):
13152
+ albumFound = True
13153
+ if (not albumFound):
13154
+ result.Items.pop(idx)
13155
+
13156
+ # apply filter criteria (if specified).
13157
+ if (filterCriteria is not None):
13158
+ _logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
13159
+ filterCriteriaCompare:str = (filterCriteria or "").lower()
13160
+ isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
13161
+ # process list in reverse order since we are removing items.
13162
+ for idx in reversed(range(len(result.Items))):
13163
+ item:Track = result.Items[idx]
13164
+ itemFound:bool = False
13165
+ if (isFilterUri):
13166
+ if ((item.Uri or "").lower() == filterCriteriaCompare):
13167
+ itemFound = True
13168
+ elif ((item.Name or "").lower().find(filterCriteriaCompare) > -1):
13169
+ itemFound = True
13170
+ if (not itemFound):
13171
+ result.Items.pop(idx)
13172
+
12991
13173
  # trace.
12992
13174
  _logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
12993
13175
  return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spotifywebapipython
3
- Version: 1.0.285
3
+ Version: 1.0.287
4
4
  Summary: Spotify Web API Python3 Library
5
5
  Author: Todd Lucas
6
6
  Author-email: <thlucas@yahoo.com>