spotifywebapiPython 1.0.152__py3-none-any.whl → 1.0.153__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.152.dist-info → spotifywebapiPython-1.0.153.dist-info}/METADATA +1 -1
  2. {spotifywebapiPython-1.0.152.dist-info → spotifywebapiPython-1.0.153.dist-info}/RECORD +21 -21
  3. spotifywebapipython/const.py +1 -1
  4. spotifywebapipython/docs/__init__.html +8 -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 +68 -9
  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/docs/spotifywebapipython/spotifywebplayertoken.html +2 -2
  18. spotifywebapipython/spotifyclient.py +41 -34
  19. {spotifywebapiPython-1.0.152.dist-info → spotifywebapiPython-1.0.153.dist-info}/LICENSE +0 -0
  20. {spotifywebapiPython-1.0.152.dist-info → spotifywebapiPython-1.0.153.dist-info}/WHEEL +0 -0
  21. {spotifywebapiPython-1.0.152.dist-info → spotifywebapiPython-1.0.153.dist-info}/top_level.txt +0 -0
@@ -12874,7 +12874,7 @@ class SpotifyClient:
12874
12874
  refreshDeviceList:bool=True,
12875
12875
  forceActivateDevice:bool=True,
12876
12876
  deviceIdFrom:str=None,
12877
- ) -> None:
12877
+ ) -> SpotifyConnectDevice:
12878
12878
  """
12879
12879
  Transfer playback to a new Spotify Connect device and optionally begin playback.
12880
12880
 
@@ -12916,6 +12916,9 @@ class SpotifyClient:
12916
12916
  for this argument.
12917
12917
  Examples are `0d1841b0976bae2a3a310dd74c0f3df354899bc8`, `Office`, `*`, None.
12918
12918
 
12919
+ Returns:
12920
+ A `SpotifyConnectDevice` object for the device where playback was transferred to.
12921
+
12919
12922
  Raises:
12920
12923
  SpotifyWebApiError:
12921
12924
  If the Spotify Web API request was for a non-authorization service
@@ -13027,7 +13030,7 @@ class SpotifyClient:
13027
13030
 
13028
13031
  # trace.
13029
13032
  _logsi.LogVerbose("Sonos device detected (IsRestricted); bypassing call to Spotify Web API Transfer Playback endpoint")
13030
- return
13033
+ return scDevice
13031
13034
 
13032
13035
  # before transferring playback to the device, we first need to check to see if anything
13033
13036
  # is currently playing. if nothing is playing then we have to start something, otherwise
@@ -13039,48 +13042,52 @@ class SpotifyClient:
13039
13042
 
13040
13043
  # if nothing is playing, then start playing track favorites instead of transferring playback.
13041
13044
  _logsi.LogVerbose("Nothing is currently playing on Spotify Connect device %s; playing track favorites on selected device instead of transferring playback" % (scDevice.Title))
13042
- tracks:TrackPageSaved = self.PlayerMediaPlayTrackFavorites(scDevice, False, limitTotal=20)
13043
-
13044
- return
13045
+ self.PlayerMediaPlayTrackFavorites(scDevice, False, limitTotal=20)
13046
+ return scDevice
13045
13047
 
13046
- # if resolved device is already active, then there is nothing to do.
13048
+ # is the resolved device already active?
13047
13049
  if (scActiveDevice.Name == scDevice.Name):
13048
- _logsi.LogVerbose("Spotify Connect device %s is already active; no need to re-activate" % (scDevice.Title))
13049
- return
13050
13050
 
13051
- # build spotify web api request parameters.
13052
- reqData:dict = \
13053
- {
13054
- 'device_ids': [scDevice.Id]
13055
- }
13056
- if (play is not None):
13057
- reqData['play'] = play
13051
+ # trace.
13052
+ _logsi.LogVerbose("Spotify Connect device %s is already active; no need to transfer playback" % (scDevice.Title))
13058
13053
 
13059
- # execute spotify web api request.
13060
- msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/me/player')
13061
- msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
13062
- msg.RequestJson = reqData
13063
- self.MakeRequest('PUT', msg)
13054
+ else:
13055
+
13056
+ # build spotify web api request parameters.
13057
+ reqData:dict = \
13058
+ {
13059
+ 'device_ids': [scDevice.Id]
13060
+ }
13061
+ if (play is not None):
13062
+ reqData['play'] = play
13063
+
13064
+ # execute spotify web api request.
13065
+ msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/me/player')
13066
+ msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
13067
+ msg.RequestJson = reqData
13068
+ self.MakeRequest('PUT', msg)
13064
13069
 
13065
- # give spotify web api time to process the change.
13066
- if delay > 0:
13067
- _logsi.LogVerbose(TRACE_MSG_DELAY_DEVICE % delay)
13068
- time.sleep(delay)
13070
+ # give spotify web api time to process the change.
13071
+ if delay > 0:
13072
+ _logsi.LogVerbose(TRACE_MSG_DELAY_DEVICE % delay)
13073
+ time.sleep(delay)
13069
13074
 
13070
- # resume play if play=True was specified.
13075
+ # pause / resume play based on `play` argument specified.
13071
13076
  # sometimes the `play` argument to the Spotify Web API transfer playback command
13072
- # is not honored, so we do a resume here to ensure it's playing.
13073
- if (play):
13074
- try:
13077
+ # is not honored, so we do a pause / resume here to ensure it's correct.
13078
+ try:
13079
+ if (play):
13075
13080
  _logsi.LogVerbose("Resuming play on device, in case it's not already playing")
13076
13081
  self.PlayerMediaResume(scDevice)
13077
- except:
13078
- # sometimes the resume will raise a "Restriction violated" error - just ignore it.
13079
- pass
13082
+ else:
13083
+ _logsi.LogVerbose("Pausing play on device, in case it's not already paused")
13084
+ self.PlayerMediaPause(scDevice)
13085
+ except:
13086
+ # in case a "Restriction violated" error is raised; just ignore it.
13087
+ pass
13080
13088
 
13081
- # process results.
13082
- # no results to process - this is pass or fail.
13083
- return
13089
+ # return target player device instance.
13090
+ return scDevice
13084
13091
 
13085
13092
  except SpotifyApiError: raise # pass handled exceptions on thru
13086
13093
  except SpotifyWebApiError: raise # pass handled exceptions on thru