spotifywebapiPython 1.0.154__py3-none-any.whl → 1.0.156__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.154.dist-info → spotifywebapiPython-1.0.156.dist-info}/METADATA +1 -1
- {spotifywebapiPython-1.0.154.dist-info → spotifywebapiPython-1.0.156.dist-info}/RECORD +23 -23
- 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 +6 -3
- spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +2 -2
- spotifywebapipython/spotifyclient.py +139 -39
- spotifywebapipython/spotifyconnect/__init__.py +2 -2
- spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +1 -1
- {spotifywebapiPython-1.0.154.dist-info → spotifywebapiPython-1.0.156.dist-info}/LICENSE +0 -0
- {spotifywebapiPython-1.0.154.dist-info → spotifywebapiPython-1.0.156.dist-info}/WHEEL +0 -0
- {spotifywebapiPython-1.0.154.dist-info → spotifywebapiPython-1.0.156.dist-info}/top_level.txt +0 -0
|
@@ -24,7 +24,7 @@ from zeroconf import Zeroconf
|
|
|
24
24
|
from .oauthcli import AuthClient
|
|
25
25
|
from .models import *
|
|
26
26
|
from .models import UserProfile as UserProfileCurrentUser
|
|
27
|
-
from .spotifyconnect import SpotifyConnectDirectoryTask
|
|
27
|
+
from .spotifyconnect import SpotifyConnectDirectoryTask, SpotifyConnectDeviceNotFound
|
|
28
28
|
from .saappmessages import SAAppMessages
|
|
29
29
|
from .spotifyapierror import SpotifyApiError
|
|
30
30
|
from .spotifyapimessage import SpotifyApiMessage
|
|
@@ -473,6 +473,25 @@ class SpotifyClient:
|
|
|
473
473
|
return self._ZeroconfClient
|
|
474
474
|
|
|
475
475
|
|
|
476
|
+
def _CheckForDeviceNotFound(
|
|
477
|
+
self,
|
|
478
|
+
scDevice:SpotifyConnectDevice,
|
|
479
|
+
deviceId:str,
|
|
480
|
+
) -> None:
|
|
481
|
+
"""
|
|
482
|
+
Called to raise a SpotifyConnectDeviceNotFound exception when a Spotify Connect
|
|
483
|
+
device could not be found and there is no active player.
|
|
484
|
+
"""
|
|
485
|
+
# was a device resolved?
|
|
486
|
+
if (scDevice is None):
|
|
487
|
+
|
|
488
|
+
# if deviceId could not be resolved, then it's an error.
|
|
489
|
+
if (deviceId is None) or (deviceId == "*"):
|
|
490
|
+
raise SpotifyConnectDeviceNotFound("There is no active Spotify player, and a default player device was not configured; select a player device and try again.")
|
|
491
|
+
else:
|
|
492
|
+
raise SpotifyConnectDeviceNotFound("Spotify Player device \"%s\" was not found, and there is no active Spotify player; verify the device is active and available on the local network, and try again." % (deviceId))
|
|
493
|
+
|
|
494
|
+
|
|
476
495
|
def _CheckForNextPageWithOffset(
|
|
477
496
|
self,
|
|
478
497
|
pageObj:PageObject,
|
|
@@ -1191,6 +1210,9 @@ class SpotifyClient:
|
|
|
1191
1210
|
This API only works for users who have Spotify Premium.
|
|
1192
1211
|
|
|
1193
1212
|
The order of execution is not guaranteed when you use this API with other Player API endpoints.
|
|
1213
|
+
|
|
1214
|
+
For Sonos devices, items are added to the end of the device local queue.
|
|
1215
|
+
For non-Sonos devices, items are added to the end of the user's current playback queue.
|
|
1194
1216
|
|
|
1195
1217
|
The Spotify Web API endpoint is called to add each item individually.
|
|
1196
1218
|
The Spotify Web API does not currently support adding more than 1 item to the queue at a time.
|
|
@@ -1228,32 +1250,59 @@ class SpotifyClient:
|
|
|
1228
1250
|
for idx in range(0, len(arrUris)):
|
|
1229
1251
|
arrUris[idx] = arrUris[idx].strip()
|
|
1230
1252
|
|
|
1231
|
-
# resolve
|
|
1253
|
+
# resolve the device object from the device id.
|
|
1232
1254
|
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, False)
|
|
1233
|
-
|
|
1234
|
-
# process all uri's.
|
|
1235
|
-
for idx in range(0, len(arrUris)):
|
|
1236
|
-
|
|
1237
|
-
# build spotify web api request parameters.
|
|
1238
|
-
urlParms:dict = \
|
|
1239
|
-
{
|
|
1240
|
-
'uri': arrUris[idx]
|
|
1241
|
-
}
|
|
1242
|
-
if (scDevice is not None):
|
|
1243
|
-
urlParms['device_id'] = scDevice.Id
|
|
1244
1255
|
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
msg.UrlParameters = urlParms
|
|
1249
|
-
self.MakeRequest('POST', msg)
|
|
1256
|
+
# is this an active Sonos device?
|
|
1257
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
1258
|
+
if (scDevice is not None) and (scDevice.IsSonos):
|
|
1250
1259
|
|
|
1251
|
-
#
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1260
|
+
# trace.
|
|
1261
|
+
_logsi.LogVerbose("Items will be added to Sonos local queue for device: %s" % (scDevice.Title))
|
|
1262
|
+
|
|
1263
|
+
# get the Sonos Controller player instance.
|
|
1264
|
+
sonosPlayer:SoCo = self.SpotifyConnectDirectory.GetSonosPlayer(scDevice)
|
|
1265
|
+
|
|
1266
|
+
# add all track items to the Sonos local queue.
|
|
1267
|
+
sharelink = ShareLinkPlugin(sonosPlayer)
|
|
1268
|
+
for idx in range(0, len(arrUris)):
|
|
1269
|
+
|
|
1270
|
+
# add track to the Sonos local queue.
|
|
1271
|
+
uri = arrUris[idx].strip()
|
|
1272
|
+
_logsi.LogVerbose("Issuing command to Sonos device \"%s\": ADD_SHARE_LINK_TO_QUEUE (uri=%s)" % (scDevice.Name, uri))
|
|
1273
|
+
sharelink.add_share_link_to_queue(uri)
|
|
1274
|
+
|
|
1275
|
+
else:
|
|
1276
|
+
|
|
1277
|
+
# trace.
|
|
1278
|
+
_logsi.LogVerbose("Items will be added to playback queue for device: %s" % (scDevice.Title))
|
|
1279
|
+
|
|
1280
|
+
# was the deviceId resolved?
|
|
1281
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
1282
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
1283
|
+
|
|
1284
|
+
# process all uri's.
|
|
1285
|
+
for idx in range(0, len(arrUris)):
|
|
1286
|
+
|
|
1287
|
+
# build spotify web api request parameters.
|
|
1288
|
+
urlParms:dict = \
|
|
1289
|
+
{
|
|
1290
|
+
'uri': arrUris[idx]
|
|
1291
|
+
}
|
|
1292
|
+
if (scDevice is not None):
|
|
1293
|
+
urlParms['device_id'] = scDevice.Id
|
|
1294
|
+
|
|
1295
|
+
# execute spotify web api request.
|
|
1296
|
+
msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/me/player/queue')
|
|
1297
|
+
msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
|
|
1298
|
+
msg.UrlParameters = urlParms
|
|
1299
|
+
self.MakeRequest('POST', msg)
|
|
1300
|
+
|
|
1301
|
+
# give spotify web api time to process the change.
|
|
1302
|
+
if delay > 0:
|
|
1303
|
+
_logsi.LogVerbose(TRACE_MSG_DELAY_DEVICE % delay)
|
|
1304
|
+
time.sleep(delay)
|
|
1255
1305
|
|
|
1256
|
-
|
|
1257
1306
|
# process results.
|
|
1258
1307
|
# no results to process - this is pass or fail.
|
|
1259
1308
|
return
|
|
@@ -11544,10 +11593,11 @@ class SpotifyClient:
|
|
|
11544
11593
|
# validations.
|
|
11545
11594
|
delay = validateDelay(delay, 0.50, 10)
|
|
11546
11595
|
|
|
11547
|
-
# resolve
|
|
11596
|
+
# resolve the device object from the device id.
|
|
11548
11597
|
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, False)
|
|
11549
11598
|
|
|
11550
11599
|
# is this an active Sonos device?
|
|
11600
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
11551
11601
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
11552
11602
|
|
|
11553
11603
|
_logsi.LogVerbose("Issuing command to Sonos device %s: PAUSE" % (scDevice.Title))
|
|
@@ -11556,6 +11606,10 @@ class SpotifyClient:
|
|
|
11556
11606
|
|
|
11557
11607
|
else:
|
|
11558
11608
|
|
|
11609
|
+
# was the deviceId resolved?
|
|
11610
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
11611
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
11612
|
+
|
|
11559
11613
|
# build spotify web api request parameters.
|
|
11560
11614
|
urlParms:dict = {}
|
|
11561
11615
|
if (scDevice is not None):
|
|
@@ -11703,10 +11757,11 @@ class SpotifyClient:
|
|
|
11703
11757
|
if (offsetPosition is None) or (offsetPosition < 0):
|
|
11704
11758
|
offsetPosition = 0
|
|
11705
11759
|
|
|
11706
|
-
# resolve
|
|
11707
|
-
scDevice = self._ResolveDeviceObject(deviceId,
|
|
11760
|
+
# resolve the device object from the device idl activate if it's dormant.
|
|
11761
|
+
scDevice = self._ResolveDeviceObject(deviceId, True)
|
|
11708
11762
|
|
|
11709
|
-
# is this
|
|
11763
|
+
# is this an active Sonos device?
|
|
11764
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
11710
11765
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
11711
11766
|
|
|
11712
11767
|
# trace.
|
|
@@ -11783,6 +11838,10 @@ class SpotifyClient:
|
|
|
11783
11838
|
# trace.
|
|
11784
11839
|
_logsi.LogVerbose("Context will be played on the Spotify Connect device via Spotify Web API")
|
|
11785
11840
|
|
|
11841
|
+
# was the deviceId resolved?
|
|
11842
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
11843
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
11844
|
+
|
|
11786
11845
|
# build spotify web api request parameters.
|
|
11787
11846
|
reqData:dict = \
|
|
11788
11847
|
{
|
|
@@ -11925,7 +11984,7 @@ class SpotifyClient:
|
|
|
11925
11984
|
for trackSaved in tracks.Items:
|
|
11926
11985
|
arrUris.append(trackSaved.Track.Uri)
|
|
11927
11986
|
|
|
11928
|
-
# resolve
|
|
11987
|
+
# resolve the device object from the device id.
|
|
11929
11988
|
scDevice = self._ResolveDeviceObject(deviceId, False)
|
|
11930
11989
|
|
|
11931
11990
|
# set desired shuffle mode.
|
|
@@ -12048,10 +12107,11 @@ class SpotifyClient:
|
|
|
12048
12107
|
for idx in range(0, len(arrUris)):
|
|
12049
12108
|
arrUris[idx] = arrUris[idx].strip()
|
|
12050
12109
|
|
|
12051
|
-
# resolve
|
|
12110
|
+
# resolve the device object from the device id; activate if it's dormant.
|
|
12052
12111
|
scDevice = self._ResolveDeviceObject(deviceId, True)
|
|
12053
12112
|
|
|
12054
|
-
# is this
|
|
12113
|
+
# is this an active Sonos device?
|
|
12114
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
12055
12115
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
12056
12116
|
|
|
12057
12117
|
# trace.
|
|
@@ -12104,6 +12164,10 @@ class SpotifyClient:
|
|
|
12104
12164
|
# trace.
|
|
12105
12165
|
_logsi.LogVerbose("Track list will be played on the Spotify Connect device via Spotify Web API")
|
|
12106
12166
|
|
|
12167
|
+
# was the deviceId resolved?
|
|
12168
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
12169
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
12170
|
+
|
|
12107
12171
|
# build spotify web api request parameters.
|
|
12108
12172
|
reqData:dict = \
|
|
12109
12173
|
{
|
|
@@ -12203,10 +12267,12 @@ class SpotifyClient:
|
|
|
12203
12267
|
# validations.
|
|
12204
12268
|
delay = validateDelay(delay, 0.50, 10)
|
|
12205
12269
|
|
|
12206
|
-
# resolve
|
|
12207
|
-
|
|
12270
|
+
# resolve the device object from the device id; activate if it's dormant.
|
|
12271
|
+
# we activate the device here, as it may have been paused for a long time.
|
|
12272
|
+
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, True)
|
|
12208
12273
|
|
|
12209
12274
|
# is this an active Sonos device?
|
|
12275
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
12210
12276
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
12211
12277
|
|
|
12212
12278
|
_logsi.LogVerbose("Issuing command to Sonos device %s: PLAY (RESUME)" % (scDevice.Title))
|
|
@@ -12215,6 +12281,10 @@ class SpotifyClient:
|
|
|
12215
12281
|
|
|
12216
12282
|
else:
|
|
12217
12283
|
|
|
12284
|
+
# was the deviceId resolved?
|
|
12285
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
12286
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
12287
|
+
|
|
12218
12288
|
# build spotify web api request parameters.
|
|
12219
12289
|
urlParms:dict = {}
|
|
12220
12290
|
if (scDevice is not None):
|
|
@@ -12341,7 +12411,7 @@ class SpotifyClient:
|
|
|
12341
12411
|
if (relativePositionMS is None):
|
|
12342
12412
|
relativePositionMS = 0
|
|
12343
12413
|
|
|
12344
|
-
# resolve
|
|
12414
|
+
# resolve the device object from the device id.
|
|
12345
12415
|
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, False)
|
|
12346
12416
|
|
|
12347
12417
|
# was relative seeking specified?
|
|
@@ -12359,6 +12429,7 @@ class SpotifyClient:
|
|
|
12359
12429
|
positionMS = newPositionMS
|
|
12360
12430
|
|
|
12361
12431
|
# is this an active Sonos device?
|
|
12432
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
12362
12433
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
12363
12434
|
|
|
12364
12435
|
sonosPosition:str = mediaPositionHMS_fromSeconds(positionMS / 1000) # convert from milliseconds to Sonos H:MM:SS format
|
|
@@ -12368,6 +12439,10 @@ class SpotifyClient:
|
|
|
12368
12439
|
|
|
12369
12440
|
else:
|
|
12370
12441
|
|
|
12442
|
+
# was the deviceId resolved?
|
|
12443
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
12444
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
12445
|
+
|
|
12371
12446
|
# build spotify web api request parameters.
|
|
12372
12447
|
urlParms:dict = \
|
|
12373
12448
|
{
|
|
@@ -12462,10 +12537,11 @@ class SpotifyClient:
|
|
|
12462
12537
|
# validations.
|
|
12463
12538
|
delay = validateDelay(delay, 0.50, 10)
|
|
12464
12539
|
|
|
12465
|
-
# resolve
|
|
12540
|
+
# resolve the device object from the device id.
|
|
12466
12541
|
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, False)
|
|
12467
12542
|
|
|
12468
12543
|
# is this an active Sonos device?
|
|
12544
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
12469
12545
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
12470
12546
|
|
|
12471
12547
|
_logsi.LogVerbose("Issuing command to Sonos device %s: NEXT" % (scDevice.Title))
|
|
@@ -12474,6 +12550,10 @@ class SpotifyClient:
|
|
|
12474
12550
|
|
|
12475
12551
|
else:
|
|
12476
12552
|
|
|
12553
|
+
# was the deviceId resolved?
|
|
12554
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
12555
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
12556
|
+
|
|
12477
12557
|
# build spotify web api request parameters.
|
|
12478
12558
|
urlParms:dict = {}
|
|
12479
12559
|
if (scDevice is not None):
|
|
@@ -12565,10 +12645,11 @@ class SpotifyClient:
|
|
|
12565
12645
|
# validations.
|
|
12566
12646
|
delay = validateDelay(delay, 0.50, 10)
|
|
12567
12647
|
|
|
12568
|
-
# resolve
|
|
12648
|
+
# resolve the device object from the device id.
|
|
12569
12649
|
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, False)
|
|
12570
12650
|
|
|
12571
12651
|
# is this an active Sonos device?
|
|
12652
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
12572
12653
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
12573
12654
|
|
|
12574
12655
|
_logsi.LogVerbose("Issuing command to Sonos device %s: PREVIOUS" % (scDevice.Title))
|
|
@@ -12577,6 +12658,10 @@ class SpotifyClient:
|
|
|
12577
12658
|
|
|
12578
12659
|
else:
|
|
12579
12660
|
|
|
12661
|
+
# was the deviceId resolved?
|
|
12662
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
12663
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
12664
|
+
|
|
12580
12665
|
# build spotify web api request parameters.
|
|
12581
12666
|
urlParms:dict = {}
|
|
12582
12667
|
if (scDevice is not None):
|
|
@@ -12676,10 +12761,11 @@ class SpotifyClient:
|
|
|
12676
12761
|
# validations.
|
|
12677
12762
|
delay = validateDelay(delay, 0.50, 10)
|
|
12678
12763
|
|
|
12679
|
-
# resolve
|
|
12764
|
+
# resolve the device object from the device id.
|
|
12680
12765
|
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, False)
|
|
12681
12766
|
|
|
12682
12767
|
# is this an active Sonos device?
|
|
12768
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
12683
12769
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
12684
12770
|
|
|
12685
12771
|
# get current Spotify Connect player state.
|
|
@@ -12705,6 +12791,10 @@ class SpotifyClient:
|
|
|
12705
12791
|
|
|
12706
12792
|
else:
|
|
12707
12793
|
|
|
12794
|
+
# was the deviceId resolved?
|
|
12795
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
12796
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
12797
|
+
|
|
12708
12798
|
# build spotify web api request parameters.
|
|
12709
12799
|
urlParms:dict = \
|
|
12710
12800
|
{
|
|
@@ -12806,10 +12896,11 @@ class SpotifyClient:
|
|
|
12806
12896
|
# validations.
|
|
12807
12897
|
delay = validateDelay(delay, 0.50, 10)
|
|
12808
12898
|
|
|
12809
|
-
# resolve
|
|
12899
|
+
# resolve the device object from the device id.
|
|
12810
12900
|
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, False)
|
|
12811
12901
|
|
|
12812
12902
|
# is this an active Sonos device?
|
|
12903
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
12813
12904
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
12814
12905
|
|
|
12815
12906
|
# get current Spotify Connect player state.
|
|
@@ -12836,6 +12927,10 @@ class SpotifyClient:
|
|
|
12836
12927
|
|
|
12837
12928
|
else:
|
|
12838
12929
|
|
|
12930
|
+
# was the deviceId resolved?
|
|
12931
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
12932
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
12933
|
+
|
|
12839
12934
|
# build spotify web api request parameters.
|
|
12840
12935
|
urlParms:dict = \
|
|
12841
12936
|
{
|
|
@@ -12936,10 +13031,11 @@ class SpotifyClient:
|
|
|
12936
13031
|
# validations.
|
|
12937
13032
|
delay = validateDelay(delay, 0.50, 10)
|
|
12938
13033
|
|
|
12939
|
-
# resolve
|
|
13034
|
+
# resolve the device object from the device id.
|
|
12940
13035
|
scDevice:SpotifyConnectDevice = self._ResolveDeviceObject(deviceId, False)
|
|
12941
13036
|
|
|
12942
13037
|
# is this an active Sonos device?
|
|
13038
|
+
# Sonos device can still be active, even if there is no active device in Spotify playstate.
|
|
12943
13039
|
if (scDevice is not None) and (scDevice.IsSonos):
|
|
12944
13040
|
|
|
12945
13041
|
_logsi.LogVerbose("Issuing command to Sonos device %s: VOLUME = %s" % (scDevice.Title, volumePercent))
|
|
@@ -12948,6 +13044,10 @@ class SpotifyClient:
|
|
|
12948
13044
|
|
|
12949
13045
|
else:
|
|
12950
13046
|
|
|
13047
|
+
# was the deviceId resolved?
|
|
13048
|
+
# if not, then raise an exception as the Spotify Web API request will fail anyway.
|
|
13049
|
+
self._CheckForDeviceNotFound(scDevice, deviceId)
|
|
13050
|
+
|
|
12951
13051
|
# build spotify web api request parameters.
|
|
12952
13052
|
urlParms:dict = \
|
|
12953
13053
|
{
|
|
@@ -13104,7 +13204,7 @@ class SpotifyClient:
|
|
|
13104
13204
|
if (scDeviceFrom is not None) and (scDeviceFrom.IsSonos):
|
|
13105
13205
|
self.PlayerMediaPause(scDeviceFrom)
|
|
13106
13206
|
|
|
13107
|
-
# resolve
|
|
13207
|
+
# resolve the device object from the device id; activate if it's dormant.
|
|
13108
13208
|
# for transfer playback, we will always activate the device.
|
|
13109
13209
|
scDevice = self._ResolveDeviceObject(deviceId, True)
|
|
13110
13210
|
|
|
@@ -4,7 +4,7 @@ from .spotifyconnectdirectorytask import SpotifyConnectDirectoryTask
|
|
|
4
4
|
from .spotifyconnectzeroconfcastapptask import SpotifyConnectZeroconfCastAppTask
|
|
5
5
|
from .spotifyconnectzeroconfcastcontroller import SpotifyConnectZeroconfCastController
|
|
6
6
|
from .spotifyconnectzeroconfcastlistener import SpotifyConnectZeroconfCastListener
|
|
7
|
-
from .spotifyconnectzeroconfexceptions import SpotifyConnectZeroconfLaunchError, SpotifyConnectZeroconfPlaybackTransferError
|
|
7
|
+
from .spotifyconnectzeroconfexceptions import SpotifyConnectZeroconfLaunchError, SpotifyConnectZeroconfPlaybackTransferError, SpotifyConnectDeviceNotFound
|
|
8
8
|
from .spotifyconnectzeroconflistener import SpotifyConnectZeroconfListener
|
|
9
9
|
|
|
10
10
|
# all classes to import when "import *" is specified.
|
|
@@ -15,5 +15,5 @@ __all__ = [
|
|
|
15
15
|
'SpotifyConnectZeroconfCastListener',
|
|
16
16
|
'SpotifyConnectDirectoryTask',
|
|
17
17
|
'SpotifyConnectZeroconfListener',
|
|
18
|
-
'SpotifyConnectZeroconfLaunchError', 'SpotifyConnectZeroconfPlaybackTransferError',
|
|
18
|
+
'SpotifyConnectZeroconfLaunchError', 'SpotifyConnectZeroconfPlaybackTransferError', 'SpotifyConnectDeviceNotFound',
|
|
19
19
|
]
|
|
@@ -1308,7 +1308,7 @@ class SpotifyConnectDirectoryTask(threading.Thread):
|
|
|
1308
1308
|
|
|
1309
1309
|
# if playerState object not supplied, then go get it.
|
|
1310
1310
|
if (playerState is None):
|
|
1311
|
-
playerState:PlayerPlayState = self._SpotifyClientInstance.GetPlayerPlaybackState()
|
|
1311
|
+
playerState:PlayerPlayState = self._SpotifyClientInstance.GetPlayerPlaybackState(additionalTypes='episode')
|
|
1312
1312
|
|
|
1313
1313
|
# if valid object then process it.
|
|
1314
1314
|
if (isinstance(playerState, PlayerPlayState)):
|
|
File without changes
|
|
File without changes
|
{spotifywebapiPython-1.0.154.dist-info → spotifywebapiPython-1.0.156.dist-info}/top_level.txt
RENAMED
|
File without changes
|