spotifywebapiPython 1.0.98__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.
- {spotifywebapiPython-1.0.98.dist-info → spotifywebapiPython-1.0.100.dist-info}/METADATA +1 -1
- {spotifywebapiPython-1.0.98.dist-info → spotifywebapiPython-1.0.100.dist-info}/RECORD +21 -21
- spotifywebapipython/const.py +1 -1
- spotifywebapipython/docs/__init__.html +15 -2
- spotifywebapipython/docs/index.html +2 -2
- spotifywebapipython/docs/search.js +1 -1
- spotifywebapipython/docs/spotifywebapiPython/const.html +3 -3
- spotifywebapipython/docs/spotifywebapiPython/saappmessages.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/sautils.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/spotifyapierror.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/spotifyapimessage.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/spotifyauthtoken.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/spotifyclient.html +17 -14
- spotifywebapipython/docs/spotifywebapiPython/spotifydiscovery.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/spotifywebapiauthenticationerror.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/spotifywebapierror.html +2 -2
- spotifywebapipython/models/playerplaystate.py +24 -0
- spotifywebapipython/spotifyclient.py +64 -46
- {spotifywebapiPython-1.0.98.dist-info → spotifywebapiPython-1.0.100.dist-info}/LICENSE +0 -0
- {spotifywebapiPython-1.0.98.dist-info → spotifywebapiPython-1.0.100.dist-info}/WHEEL +0 -0
- {spotifywebapiPython-1.0.98.dist-info → spotifywebapiPython-1.0.100.dist-info}/top_level.txt +0 -0
|
@@ -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:
|
|
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: `
|
|
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):
|
|
@@ -6767,6 +6767,17 @@ class SpotifyClient:
|
|
|
6767
6767
|
|
|
6768
6768
|
# process results.
|
|
6769
6769
|
result = PlayerPlayState(root=msg.ResponseData)
|
|
6770
|
+
|
|
6771
|
+
# is this an episode? if so, then determine the item type (e.g. podcast or audiobook).
|
|
6772
|
+
if (result is not None):
|
|
6773
|
+
if (result.Item is not None):
|
|
6774
|
+
result.ItemType = SpotifyClient.GetTypeFromUri(result.Item.Uri)
|
|
6775
|
+
if (result.CurrentlyPlayingType == 'episode'):
|
|
6776
|
+
uriId:str = SpotifyClient.GetIdFromUri(result.Item.Uri)
|
|
6777
|
+
if (self.IsChapterEpisode(uriId)):
|
|
6778
|
+
result.ItemType = 'audiobook'
|
|
6779
|
+
else:
|
|
6780
|
+
result.ItemType = 'podcast'
|
|
6770
6781
|
|
|
6771
6782
|
# trace.
|
|
6772
6783
|
_logsi.LogObject(SILevel.Verbose, TRACE_METHOD_RESULT_TYPE % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
@@ -7061,7 +7072,18 @@ class SpotifyClient:
|
|
|
7061
7072
|
|
|
7062
7073
|
# process results.
|
|
7063
7074
|
result = PlayerPlayState(root=msg.ResponseData)
|
|
7064
|
-
|
|
7075
|
+
|
|
7076
|
+
# is this an episode? if so, then determine the item type (e.g. podcast or audiobook).
|
|
7077
|
+
if (result is not None):
|
|
7078
|
+
if (result.Item is not None):
|
|
7079
|
+
result.ItemType = SpotifyClient.GetTypeFromUri(result.Item.Uri)
|
|
7080
|
+
if (result.CurrentlyPlayingType == 'episode'):
|
|
7081
|
+
uriId:str = SpotifyClient.GetIdFromUri(result.Item.Uri)
|
|
7082
|
+
if (self.IsChapterEpisode(uriId)):
|
|
7083
|
+
result.ItemType = 'audiobook'
|
|
7084
|
+
else:
|
|
7085
|
+
result.ItemType = 'podcast'
|
|
7086
|
+
|
|
7065
7087
|
# check for a restricted device; if found, then grab the device id from the
|
|
7066
7088
|
# cached list of spotify connect devices (if present).
|
|
7067
7089
|
if result is not None:
|
|
@@ -8628,7 +8650,8 @@ class SpotifyClient:
|
|
|
8628
8650
|
True to refresh the Spotify Connect device list; otherwise, False to use the
|
|
8629
8651
|
Spotify Connect device list cache.
|
|
8630
8652
|
activateDevice (bool):
|
|
8631
|
-
True to activate the device if necessary; otherwise, False.
|
|
8653
|
+
True to activate the device if necessary; otherwise, False.
|
|
8654
|
+
Default is True.
|
|
8632
8655
|
delay (float):
|
|
8633
8656
|
Time delay (in seconds) to wait AFTER issuing any command to the device.
|
|
8634
8657
|
This delay will give the spotify zeroconf api time to process the change before
|
|
@@ -8657,14 +8680,12 @@ class SpotifyClient:
|
|
|
8657
8680
|
|
|
8658
8681
|
The `SpotifyConnectDevice` object is returned if a match is found; otherwise, a null value is
|
|
8659
8682
|
returned.
|
|
8660
|
-
|
|
8661
|
-
A user context switch will also be performed if a device id is resolved AND the active user of the
|
|
8662
|
-
device does not match the `SpotifyConnectUsername` argument specified on the class constructor.
|
|
8663
|
-
The user context switch is bypassed if the `verifyUserContext` argument is False, or if the
|
|
8664
|
-
`SpotifyConnectUsername` was not supplied on the class constructor. If the user context is to be
|
|
8665
|
-
switched, then a Disconnect will be issued if a user context is active on the device followed by
|
|
8666
|
-
a Connect to the user context specified on the class constructor.
|
|
8667
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
|
+
|
|
8668
8689
|
<details>
|
|
8669
8690
|
<summary>Sample Code</summary>
|
|
8670
8691
|
```python
|
|
@@ -8757,7 +8778,8 @@ class SpotifyClient:
|
|
|
8757
8778
|
# did we resolve the device id?
|
|
8758
8779
|
if deviceResult is not None:
|
|
8759
8780
|
|
|
8760
|
-
# 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`).
|
|
8761
8783
|
|
|
8762
8784
|
# reset device reconnected flag.
|
|
8763
8785
|
scDevice.WasReConnected = False
|
|
@@ -8802,35 +8824,28 @@ class SpotifyClient:
|
|
|
8802
8824
|
# store the currently active user of the device, in case we need to switch users later on.
|
|
8803
8825
|
deviceActiveUser = info.ActiveUser.lower()
|
|
8804
8826
|
|
|
8805
|
-
# was device activation requested? if not, then we are done.
|
|
8806
|
-
if activateDevice == False:
|
|
8807
|
-
_logsi.LogVerbose("Activation not requested for Spotify Connect device: '%s'" % (deviceResult.Title))
|
|
8808
|
-
break
|
|
8809
|
-
|
|
8810
8827
|
# is this a dynamic device? if so, then there is no need to activate it as it's already active.
|
|
8811
8828
|
if (discoverResult.IsDynamicDevice):
|
|
8812
8829
|
_logsi.LogVerbose("Activation not required for dynamic Spotify Connect device: '%s'" % (deviceResult.Title))
|
|
8813
8830
|
break
|
|
8814
8831
|
|
|
8815
|
-
#
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
_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))
|
|
8819
8835
|
break
|
|
8820
8836
|
|
|
8837
|
+
zcfResult:ZeroconfResponse
|
|
8838
|
+
|
|
8821
8839
|
# was a Spotify Connect user account specified on the class constructor?
|
|
8822
|
-
# if not, then
|
|
8840
|
+
# if not, then we cannot re-activate the device!
|
|
8823
8841
|
if (self._SpotifyConnectUsername is None):
|
|
8824
|
-
|
|
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))
|
|
8825
8844
|
break
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
# the current user context before connecting a different user.
|
|
8831
|
-
if (info.HasActiveUser):
|
|
8832
|
-
_logsi.LogVerbose("Issuing Disconnect to Spotify Connect device '%s' for user context '%s'" % (deviceResult.Title, deviceActiveUser))
|
|
8833
|
-
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)
|
|
8834
8849
|
|
|
8835
8850
|
# connect the device to OUR Spotify Connect user context.
|
|
8836
8851
|
# note that the result here only indicates that the connect was submitted - NOT that it was successful!
|
|
@@ -10874,13 +10889,12 @@ class SpotifyClient:
|
|
|
10874
10889
|
# has the device id been resolved?
|
|
10875
10890
|
if (resolveDeviceId):
|
|
10876
10891
|
|
|
10877
|
-
# ensure the specified device id / name is active and available, and
|
|
10892
|
+
# no - ensure the specified device id / name is active and available, and
|
|
10878
10893
|
# the user context is set correctly.
|
|
10879
10894
|
scDevice = self.GetSpotifyConnectDevice(
|
|
10880
10895
|
deviceId,
|
|
10881
10896
|
refreshDeviceList=False,
|
|
10882
|
-
activateDevice=True
|
|
10883
|
-
verifyUserContext=True)
|
|
10897
|
+
activateDevice=True)
|
|
10884
10898
|
|
|
10885
10899
|
# did we find the device?
|
|
10886
10900
|
# if so, then use the found device id in case a device name was specified.
|
|
@@ -11016,13 +11030,12 @@ class SpotifyClient:
|
|
|
11016
11030
|
# has the device id been resolved?
|
|
11017
11031
|
if (resolveDeviceId):
|
|
11018
11032
|
|
|
11019
|
-
# ensure the specified device id / name is active and available, and
|
|
11033
|
+
# no - ensure the specified device id / name is active and available, and
|
|
11020
11034
|
# the user context is set correctly.
|
|
11021
11035
|
scDevice = self.GetSpotifyConnectDevice(
|
|
11022
11036
|
deviceId,
|
|
11023
11037
|
refreshDeviceList=False,
|
|
11024
|
-
activateDevice=True
|
|
11025
|
-
verifyUserContext=True)
|
|
11038
|
+
activateDevice=True)
|
|
11026
11039
|
|
|
11027
11040
|
# did we find the device?
|
|
11028
11041
|
# if so, then use the found device id in case a device name was specified.
|
|
@@ -11144,13 +11157,12 @@ class SpotifyClient:
|
|
|
11144
11157
|
# has the device id been resolved?
|
|
11145
11158
|
if (resolveDeviceId):
|
|
11146
11159
|
|
|
11147
|
-
# ensure the specified device id / name is active and available, and
|
|
11160
|
+
# no - ensure the specified device id / name is active and available, and
|
|
11148
11161
|
# the user context is set correctly.
|
|
11149
11162
|
scDevice = self.GetSpotifyConnectDevice(
|
|
11150
11163
|
deviceId,
|
|
11151
11164
|
refreshDeviceList=False,
|
|
11152
|
-
activateDevice=True
|
|
11153
|
-
verifyUserContext=True)
|
|
11165
|
+
activateDevice=True)
|
|
11154
11166
|
|
|
11155
11167
|
# did we find the device?
|
|
11156
11168
|
# if so, then use the found device id in case a device name was specified.
|
|
@@ -11674,7 +11686,6 @@ class SpotifyClient:
|
|
|
11674
11686
|
# call newer method to resolve the device id.
|
|
11675
11687
|
scDevice:SpotifyConnectDevice = self.GetSpotifyConnectDevice(
|
|
11676
11688
|
deviceValue=deviceValue,
|
|
11677
|
-
verifyUserContext=verifyUserContext,
|
|
11678
11689
|
verifyTimeout=verifyTimeout,
|
|
11679
11690
|
refreshDeviceList=True,
|
|
11680
11691
|
activateDevice=True,
|
|
@@ -12018,6 +12029,7 @@ class SpotifyClient:
|
|
|
12018
12029
|
play:bool=True,
|
|
12019
12030
|
delay:float=0.50,
|
|
12020
12031
|
refreshDeviceList:bool=True,
|
|
12032
|
+
forceActivateDevice:bool=True,
|
|
12021
12033
|
) -> None:
|
|
12022
12034
|
"""
|
|
12023
12035
|
Transfer playback to a new Spotify Connect device and optionally begin playback.
|
|
@@ -12043,6 +12055,11 @@ class SpotifyClient:
|
|
|
12043
12055
|
True to refresh the Spotify Connect device list; otherwise, False to use the
|
|
12044
12056
|
Spotify Connect device list cache.
|
|
12045
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.
|
|
12046
12063
|
|
|
12047
12064
|
Raises:
|
|
12048
12065
|
SpotifyWebApiError:
|
|
@@ -12074,6 +12091,7 @@ class SpotifyClient:
|
|
|
12074
12091
|
apiMethodParms.AppendKeyValue("play", play)
|
|
12075
12092
|
apiMethodParms.AppendKeyValue("delay", delay)
|
|
12076
12093
|
apiMethodParms.AppendKeyValue("refreshDeviceList", refreshDeviceList)
|
|
12094
|
+
apiMethodParms.AppendKeyValue("forceActivateDevice", forceActivateDevice)
|
|
12077
12095
|
_logsi.LogMethodParmList(SILevel.Verbose, "Transfer playback to a new Spotify Connect device", apiMethodParms)
|
|
12078
12096
|
|
|
12079
12097
|
# validations.
|
|
@@ -12083,9 +12101,8 @@ class SpotifyClient:
|
|
|
12083
12101
|
# the user context is set correctly.
|
|
12084
12102
|
scDevice = self.GetSpotifyConnectDevice(
|
|
12085
12103
|
deviceId,
|
|
12086
|
-
verifyUserContext=True,
|
|
12087
12104
|
refreshDeviceList=refreshDeviceList,
|
|
12088
|
-
activateDevice=
|
|
12105
|
+
activateDevice=forceActivateDevice)
|
|
12089
12106
|
|
|
12090
12107
|
# did we find the device?
|
|
12091
12108
|
# if so, then use the found device id in case a device name was specified.
|
|
@@ -12095,7 +12112,8 @@ class SpotifyClient:
|
|
|
12095
12112
|
|
|
12096
12113
|
# is this a Sonos device?
|
|
12097
12114
|
# if so, then control was automatically transferred by activating the device.
|
|
12098
|
-
#
|
|
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!
|
|
12099
12117
|
if scDevice.DeviceInfo.IsBrandSonos:
|
|
12100
12118
|
_logsi.LogVerbose('Sonos device detected; bypassing call to Spotify Web API Transfer Playback endpoint')
|
|
12101
12119
|
return
|
|
@@ -12586,7 +12604,7 @@ class SpotifyClient:
|
|
|
12586
12604
|
Example: `5AC9ZXA7nJ7oGWO911FuDG`
|
|
12587
12605
|
uris (str):
|
|
12588
12606
|
A comma-separated list of Spotify URIs to remove; can be track or episode URIs.
|
|
12589
|
-
Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:
|
|
12607
|
+
Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:26c0zVyOv1lzfYpBXdh1zC`.
|
|
12590
12608
|
A maximum of 100 items can be specified in one request.
|
|
12591
12609
|
If null, the currently playing context uri value is used.
|
|
12592
12610
|
snapshotId (str):
|
|
@@ -12993,7 +13011,7 @@ class SpotifyClient:
|
|
|
12993
13011
|
Example: `5AC9ZXA7nJ7oGWO911FuDG`
|
|
12994
13012
|
uris (str):
|
|
12995
13013
|
A comma-separated list of Spotify URIs to replace; can be track or episode URIs.
|
|
12996
|
-
Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:
|
|
13014
|
+
Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:26c0zVyOv1lzfYpBXdh1zC`.
|
|
12997
13015
|
A maximum of 100 items can be specified in one request.
|
|
12998
13016
|
|
|
12999
13017
|
Returns:
|
|
File without changes
|
|
File without changes
|
{spotifywebapiPython-1.0.98.dist-info → spotifywebapiPython-1.0.100.dist-info}/top_level.txt
RENAMED
|
File without changes
|