spotifywebapiPython 1.0.118__py3-none-any.whl → 1.0.120__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.

Potentially problematic release.


This version of spotifywebapiPython might be problematic. Click here for more details.

Files changed (21) hide show
  1. {spotifywebapiPython-1.0.118.dist-info → spotifywebapiPython-1.0.120.dist-info}/METADATA +1 -1
  2. {spotifywebapiPython-1.0.118.dist-info → spotifywebapiPython-1.0.120.dist-info}/RECORD +21 -21
  3. spotifywebapipython/const.py +1 -1
  4. spotifywebapipython/docs/__init__.html +17 -2
  5. spotifywebapipython/docs/index.html +2 -2
  6. spotifywebapipython/docs/search.js +1 -1
  7. spotifywebapipython/docs/spotifywebapipython/const.html +3 -3
  8. spotifywebapipython/docs/spotifywebapipython/saappmessages.html +2 -2
  9. spotifywebapipython/docs/spotifywebapipython/sautils.html +2 -2
  10. spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +2 -2
  11. spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +2 -2
  12. spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +2 -2
  13. spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +23 -6
  14. spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +2 -2
  15. spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +2 -2
  16. spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +2 -2
  17. spotifywebapipython/models/trackrecommendations.py +5 -5
  18. spotifywebapipython/spotifyclient.py +50 -13
  19. {spotifywebapiPython-1.0.118.dist-info → spotifywebapiPython-1.0.120.dist-info}/LICENSE +0 -0
  20. {spotifywebapiPython-1.0.118.dist-info → spotifywebapiPython-1.0.120.dist-info}/WHEEL +0 -0
  21. {spotifywebapiPython-1.0.118.dist-info → spotifywebapiPython-1.0.120.dist-info}/top_level.txt +0 -0
@@ -43,6 +43,7 @@ from .const import (
43
43
  TRACE_MSG_DELAY_DEVICE,
44
44
  TRACE_MSG_USERPROFILE,
45
45
  TRACE_WARN_SPOTIFY_SEARCH_NO_MARKET,
46
+ VERSION
46
47
  )
47
48
 
48
49
  CACHE_SOURCE_CACHED:str = "cached"
@@ -357,6 +358,14 @@ class SpotifyClient:
357
358
  return self._UserProfile
358
359
 
359
360
 
361
+ @property
362
+ def Version(self) -> str:
363
+ """
364
+ The current API version identifier.
365
+ """
366
+ return VERSION
367
+
368
+
360
369
  @property
361
370
  def ZeroconfClient(self) -> Zeroconf:
362
371
  """
@@ -2060,7 +2069,7 @@ class SpotifyClient:
2060
2069
  ids (str):
2061
2070
  A comma-separated list of Spotify user ID's to check.
2062
2071
  Maximum: 50 ID's.
2063
- Example: `smedjan`
2072
+ Example: `smedjan,smedjan123`
2064
2073
 
2065
2074
  Returns:
2066
2075
  A dictionary of the IDs, along with a boolean status for each that indicates
@@ -6836,7 +6845,7 @@ class SpotifyClient:
6836
6845
 
6837
6846
  # if it IS a hex string, then it should have been converted to a number.
6838
6847
  # at this point we can assume it's a device id. in this case, just return it.
6839
- # note that we will NOT perform a lookup in the device list .
6848
+ # note that we will NOT perform a lookup in the device list.
6840
6849
  _logsi.LogVerbose("Device id '%s' was specified, and will be used as-is" % value)
6841
6850
  if intValue is not None:
6842
6851
  return value
@@ -7797,15 +7806,17 @@ class SpotifyClient:
7797
7806
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
7798
7807
 
7799
7808
 
7800
- def GetPlaylistCoverImage(self,
7801
- playlistId:str,
7802
- ) -> ImageObject:
7809
+ def GetPlaylistCoverImage(
7810
+ self,
7811
+ playlistId:str=None,
7812
+ ) -> ImageObject:
7803
7813
  """
7804
7814
  Get the current image associated with a specific playlist.
7805
7815
 
7806
7816
  Args:
7807
7817
  playlistId (str):
7808
7818
  The Spotify ID of the playlist.
7819
+ If null, the currently playing playlist uri id value is used.
7809
7820
  Example: `5v5ETK9WFXAnGQ3MRubKuE`
7810
7821
 
7811
7822
  Returns:
@@ -7836,6 +7847,14 @@ class SpotifyClient:
7836
7847
  apiMethodParms.AppendKeyValue("playlistId", playlistId)
7837
7848
  _logsi.LogMethodParmList(SILevel.Verbose, "Get the current image associated with a specific playlist", apiMethodParms)
7838
7849
 
7850
+ # if playlistId not specified, then return currently playing playlist id value.
7851
+ if (playlistId is None) or (len(playlistId.strip()) == 0):
7852
+ uri = self.GetPlayerNowPlayingPlaylistUri()
7853
+ if uri is not None:
7854
+ playlistId = SpotifyClient.GetIdFromUri(uri)
7855
+ else:
7856
+ raise SpotifyApiError(SAAppMessages.ARGUMENT_REQUIRED_ERROR % (apiMethodName, 'playlistId'), logsi=_logsi)
7857
+
7839
7858
  # execute spotify web api request.
7840
7859
  msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/playlists/{playlist_id}/images'.format(playlist_id=playlistId))
7841
7860
  msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
@@ -8269,7 +8288,7 @@ class SpotifyClient:
8269
8288
  Default: True
8270
8289
 
8271
8290
  Returns:
8272
- An `PlaylistPageSimplified` object that contains playlist information.
8291
+ An `PlaylistPageSimplified` object that contains user playlist information.
8273
8292
 
8274
8293
  Raises:
8275
8294
  SpotifyWebApiError:
@@ -13302,13 +13321,14 @@ class SpotifyClient:
13302
13321
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
13303
13322
 
13304
13323
 
13305
- def ReorderPlaylistItems(self,
13306
- playlistId:str,
13307
- rangeStart:int,
13308
- insertBefore:int,
13309
- rangeLength:int=1,
13310
- snapshotId:str=None
13311
- ) -> str:
13324
+ def ReorderPlaylistItems(
13325
+ self,
13326
+ playlistId:str,
13327
+ rangeStart:int,
13328
+ insertBefore:int,
13329
+ rangeLength:int=1,
13330
+ snapshotId:str=None
13331
+ ) -> str:
13312
13332
  """
13313
13333
  Reorder items in a user's playlist.
13314
13334
 
@@ -13377,6 +13397,14 @@ class SpotifyClient:
13377
13397
  apiMethodParms.AppendKeyValue("rangeLength", rangeLength)
13378
13398
  apiMethodParms.AppendKeyValue("snapshotId", snapshotId)
13379
13399
  _logsi.LogMethodParmList(SILevel.Verbose, "Reorder items in a user's playlist", apiMethodParms)
13400
+
13401
+ # validations.
13402
+ if (rangeStart is None):
13403
+ rangeStart = 1
13404
+ if (insertBefore is None):
13405
+ insertBefore = 1
13406
+ if (rangeLength is None):
13407
+ rangeLength = 1
13380
13408
 
13381
13409
  # build spotify web api request parameters.
13382
13410
  reqData:dict = \
@@ -13465,12 +13493,21 @@ class SpotifyClient:
13465
13493
  apiMethodParms.AppendKeyValue("playlistId", playlistId)
13466
13494
  apiMethodParms.AppendKeyValue("uris", uris)
13467
13495
  _logsi.LogMethodParmList(SILevel.Verbose, "Replace one or more items in a user's playlist", apiMethodParms)
13496
+
13497
+ # validations.
13498
+ if (uris is None):
13499
+ uris = ""
13500
+ uris = uris.strip();
13468
13501
 
13469
13502
  # build a list of all item uri's.
13470
13503
  # remove any leading / trailing spaces in case user put a space between the items.
13471
13504
  arrUris:list[str] = uris.split(',')
13472
13505
  for idx in range(0, len(arrUris)):
13473
13506
  arrUris[idx] = arrUris[idx].strip()
13507
+
13508
+ # if no items are present, then clear the array (can't have empty string items).
13509
+ if (len(arrUris) == 1) and (arrUris[0] == ""):
13510
+ arrUris = []
13474
13511
 
13475
13512
  # build spotify web api request parameters.
13476
13513
  reqData:dict = \