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

@@ -1022,7 +1022,7 @@ class SpotifyClient:
1022
1022
  Example: `5AC9ZXA7nJ7oGWO911FuDG`
1023
1023
  uris (str):
1024
1024
  A comma-separated list of Spotify URIs to add; can be track or episode URIs.
1025
- Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:512ojhOuo1ktJprKbVcKyQ`.
1025
+ Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:26c0zVyOv1lzfYpBXdh1zC`.
1026
1026
  A maximum of 100 items can be specified in one request.
1027
1027
  If null, the currently playing context uri value is used.
1028
1028
  position (int):
@@ -5420,7 +5420,7 @@ class SpotifyClient:
5420
5420
  Args:
5421
5421
  episodeId (str):
5422
5422
  The Spotify ID for the episode.
5423
- Example: `512ojhOuo1ktJprKbVcKyQ`
5423
+ Example: `26c0zVyOv1lzfYpBXdh1zC`
5424
5424
  If null, the currently playing episode uri id value is used; a Spotify Free or Premium account
5425
5425
  is required to correctly read the currently playing context.
5426
5426
  market (str):
@@ -8650,7 +8650,8 @@ class SpotifyClient:
8650
8650
  True to refresh the Spotify Connect device list; otherwise, False to use the
8651
8651
  Spotify Connect device list cache.
8652
8652
  activateDevice (bool):
8653
- True to activate the device if necessary; otherwise, False.
8653
+ True to activate the device if necessary; otherwise, False.
8654
+ Default is True.
8654
8655
  delay (float):
8655
8656
  Time delay (in seconds) to wait AFTER issuing any command to the device.
8656
8657
  This delay will give the spotify zeroconf api time to process the change before
@@ -8679,14 +8680,12 @@ class SpotifyClient:
8679
8680
 
8680
8681
  The `SpotifyConnectDevice` object is returned if a match is found; otherwise, a null value is
8681
8682
  returned.
8682
-
8683
- A user context switch will also be performed if a device id is resolved AND the active user of the
8684
- device does not match the `SpotifyConnectUsername` argument specified on the class constructor.
8685
- The user context switch is bypassed if the `verifyUserContext` argument is False, or if the
8686
- `SpotifyConnectUsername` was not supplied on the class constructor. If the user context is to be
8687
- switched, then a Disconnect will be issued if a user context is active on the device followed by
8688
- a Connect to the user context specified on the class constructor.
8689
8683
 
8684
+ A Spotify Connect Zeroconf Disconnect (e.g. `resetUsers`) will be issued if the `activateDevice`
8685
+ argument is True, AND the device is not a dynamic device. This will temporarily remove the device
8686
+ from the Spotify Connect device list, but the device will be re-added when the Connect
8687
+ call is issued.
8688
+
8690
8689
  <details>
8691
8690
  <summary>Sample Code</summary>
8692
8691
  ```python
@@ -8779,7 +8778,8 @@ class SpotifyClient:
8779
8778
  # did we resolve the device id?
8780
8779
  if deviceResult is not None:
8781
8780
 
8782
- # at this point, we will try to activate the device if it requires it.
8781
+ # at this point, we will try to activate the device if it requires it
8782
+ # of if the caller forces us to do so (e.g. `activateDevice=True`).
8783
8783
 
8784
8784
  # reset device reconnected flag.
8785
8785
  scDevice.WasReConnected = False
@@ -8824,35 +8824,28 @@ class SpotifyClient:
8824
8824
  # store the currently active user of the device, in case we need to switch users later on.
8825
8825
  deviceActiveUser = info.ActiveUser.lower()
8826
8826
 
8827
- # was device activation requested? if not, then we are done.
8828
- if activateDevice == False:
8829
- _logsi.LogVerbose("Activation not requested for Spotify Connect device: '%s'" % (deviceResult.Title))
8830
- break
8831
-
8832
8827
  # is this a dynamic device? if so, then there is no need to activate it as it's already active.
8833
8828
  if (discoverResult.IsDynamicDevice):
8834
8829
  _logsi.LogVerbose("Activation not required for dynamic Spotify Connect device: '%s'" % (deviceResult.Title))
8835
8830
  break
8836
8831
 
8837
- # did caller request user context switch bypass?
8838
- # if so, then just return the device.
8839
- if (not verifyUserContext):
8840
- _logsi.LogVerbose("User context '%s' will be used for Spotify Connect device '%s', as user chose to bypass user context switch" % (deviceActiveUser, deviceResult.Title))
8832
+ # was device activation requested? if not, then we are done.
8833
+ if (not activateDevice):
8834
+ _logsi.LogVerbose("Activation not requested for Spotify Connect device: '%s'" % (deviceResult.Title))
8841
8835
  break
8842
8836
 
8837
+ zcfResult:ZeroconfResponse
8838
+
8843
8839
  # was a Spotify Connect user account specified on the class constructor?
8844
- # if not, then do not switch the user context.
8840
+ # if not, then we cannot re-activate the device!
8845
8841
  if (self._SpotifyConnectUsername is None):
8846
- _logsi.LogVerbose("User context '%s' will be used for Spotify Connect device '%s', as a SpotifyConnectUsername parameter was not supplied" % (deviceActiveUser, deviceResult.Title))
8842
+ raise SpotifyApiError("A SpotifyConnectUsername parameter was not supplied; could not reactivate Spotify Connect device '%s'" % (deviceResult.Title), logsi=_logsi)
8843
+ #_logsi.LogVerbose("A SpotifyConnectUsername parameter was not supplied; could not reactivate Spotify Connect device '%s'" % (deviceResult.Title))
8847
8844
  break
8848
-
8849
- zcfResult:ZeroconfResponse
8850
-
8851
- # if a different user context has control of the device then we need to disconnect
8852
- # the current user context before connecting a different user.
8853
- if (info.HasActiveUser):
8854
- _logsi.LogVerbose("Issuing Disconnect to Spotify Connect device '%s' for user context '%s'" % (deviceResult.Title, deviceActiveUser))
8855
- zcfResult = zconn.Disconnect(delay)
8845
+
8846
+ # disconnect the device.
8847
+ _logsi.LogVerbose("Issuing Disconnect to Spotify Connect device '%s' for current user context '%s'" % (deviceResult.Title, deviceActiveUser))
8848
+ zcfResult = zconn.Disconnect(delay)
8856
8849
 
8857
8850
  # connect the device to OUR Spotify Connect user context.
8858
8851
  # note that the result here only indicates that the connect was submitted - NOT that it was successful!
@@ -10896,13 +10889,12 @@ class SpotifyClient:
10896
10889
  # has the device id been resolved?
10897
10890
  if (resolveDeviceId):
10898
10891
 
10899
- # ensure the specified device id / name is active and available, and
10892
+ # no - ensure the specified device id / name is active and available, and
10900
10893
  # the user context is set correctly.
10901
10894
  scDevice = self.GetSpotifyConnectDevice(
10902
10895
  deviceId,
10903
10896
  refreshDeviceList=False,
10904
- activateDevice=True,
10905
- verifyUserContext=True)
10897
+ activateDevice=True)
10906
10898
 
10907
10899
  # did we find the device?
10908
10900
  # if so, then use the found device id in case a device name was specified.
@@ -11038,13 +11030,12 @@ class SpotifyClient:
11038
11030
  # has the device id been resolved?
11039
11031
  if (resolveDeviceId):
11040
11032
 
11041
- # ensure the specified device id / name is active and available, and
11033
+ # no - ensure the specified device id / name is active and available, and
11042
11034
  # the user context is set correctly.
11043
11035
  scDevice = self.GetSpotifyConnectDevice(
11044
11036
  deviceId,
11045
11037
  refreshDeviceList=False,
11046
- activateDevice=True,
11047
- verifyUserContext=True)
11038
+ activateDevice=True)
11048
11039
 
11049
11040
  # did we find the device?
11050
11041
  # if so, then use the found device id in case a device name was specified.
@@ -11166,13 +11157,12 @@ class SpotifyClient:
11166
11157
  # has the device id been resolved?
11167
11158
  if (resolveDeviceId):
11168
11159
 
11169
- # ensure the specified device id / name is active and available, and
11160
+ # no - ensure the specified device id / name is active and available, and
11170
11161
  # the user context is set correctly.
11171
11162
  scDevice = self.GetSpotifyConnectDevice(
11172
11163
  deviceId,
11173
11164
  refreshDeviceList=False,
11174
- activateDevice=True,
11175
- verifyUserContext=True)
11165
+ activateDevice=True)
11176
11166
 
11177
11167
  # did we find the device?
11178
11168
  # if so, then use the found device id in case a device name was specified.
@@ -11696,7 +11686,6 @@ class SpotifyClient:
11696
11686
  # call newer method to resolve the device id.
11697
11687
  scDevice:SpotifyConnectDevice = self.GetSpotifyConnectDevice(
11698
11688
  deviceValue=deviceValue,
11699
- verifyUserContext=verifyUserContext,
11700
11689
  verifyTimeout=verifyTimeout,
11701
11690
  refreshDeviceList=True,
11702
11691
  activateDevice=True,
@@ -12040,6 +12029,7 @@ class SpotifyClient:
12040
12029
  play:bool=True,
12041
12030
  delay:float=0.50,
12042
12031
  refreshDeviceList:bool=True,
12032
+ forceActivateDevice:bool=True,
12043
12033
  ) -> None:
12044
12034
  """
12045
12035
  Transfer playback to a new Spotify Connect device and optionally begin playback.
@@ -12065,6 +12055,11 @@ class SpotifyClient:
12065
12055
  True to refresh the Spotify Connect device list; otherwise, False to use the
12066
12056
  Spotify Connect device list cache.
12067
12057
  Default is True.
12058
+ forceActivateDevice (bool):
12059
+ True to issue a Spotify Connect Disconnect call prior to transfer, which will
12060
+ force the device to reconnect to Spotify Connect; otherwise, False to not
12061
+ disconnect.
12062
+ Default is True.
12068
12063
 
12069
12064
  Raises:
12070
12065
  SpotifyWebApiError:
@@ -12096,6 +12091,7 @@ class SpotifyClient:
12096
12091
  apiMethodParms.AppendKeyValue("play", play)
12097
12092
  apiMethodParms.AppendKeyValue("delay", delay)
12098
12093
  apiMethodParms.AppendKeyValue("refreshDeviceList", refreshDeviceList)
12094
+ apiMethodParms.AppendKeyValue("forceActivateDevice", forceActivateDevice)
12099
12095
  _logsi.LogMethodParmList(SILevel.Verbose, "Transfer playback to a new Spotify Connect device", apiMethodParms)
12100
12096
 
12101
12097
  # validations.
@@ -12105,9 +12101,8 @@ class SpotifyClient:
12105
12101
  # the user context is set correctly.
12106
12102
  scDevice = self.GetSpotifyConnectDevice(
12107
12103
  deviceId,
12108
- verifyUserContext=True,
12109
12104
  refreshDeviceList=refreshDeviceList,
12110
- activateDevice=True)
12105
+ activateDevice=forceActivateDevice)
12111
12106
 
12112
12107
  # did we find the device?
12113
12108
  # if so, then use the found device id in case a device name was specified.
@@ -12117,7 +12112,8 @@ class SpotifyClient:
12117
12112
 
12118
12113
  # is this a Sonos device?
12119
12114
  # if so, then control was automatically transferred by activating the device.
12120
- # it's a restricted device, so the Spotify Web API cannot control it!
12115
+ # note that we also cannot stop nor start play on the device either, as it's
12116
+ # considered a restricted device and the Spotify Web API cannot control it!
12121
12117
  if scDevice.DeviceInfo.IsBrandSonos:
12122
12118
  _logsi.LogVerbose('Sonos device detected; bypassing call to Spotify Web API Transfer Playback endpoint')
12123
12119
  return
@@ -12608,7 +12604,7 @@ class SpotifyClient:
12608
12604
  Example: `5AC9ZXA7nJ7oGWO911FuDG`
12609
12605
  uris (str):
12610
12606
  A comma-separated list of Spotify URIs to remove; can be track or episode URIs.
12611
- Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:512ojhOuo1ktJprKbVcKyQ`.
12607
+ Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:26c0zVyOv1lzfYpBXdh1zC`.
12612
12608
  A maximum of 100 items can be specified in one request.
12613
12609
  If null, the currently playing context uri value is used.
12614
12610
  snapshotId (str):
@@ -13015,7 +13011,7 @@ class SpotifyClient:
13015
13011
  Example: `5AC9ZXA7nJ7oGWO911FuDG`
13016
13012
  uris (str):
13017
13013
  A comma-separated list of Spotify URIs to replace; can be track or episode URIs.
13018
- Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:512ojhOuo1ktJprKbVcKyQ`.
13014
+ Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:26c0zVyOv1lzfYpBXdh1zC`.
13019
13015
  A maximum of 100 items can be specified in one request.
13020
13016
 
13021
13017
  Returns: