spotifywebapiPython 1.0.34__py3-none-any.whl → 1.0.36__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.34.dist-info → spotifywebapiPython-1.0.36.dist-info}/METADATA +1 -1
- {spotifywebapiPython-1.0.34.dist-info → spotifywebapiPython-1.0.36.dist-info}/RECORD +20 -20
- spotifywebapipython/const.py +1 -1
- spotifywebapipython/docs/__init__.html +20 -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 +36 -10
- spotifywebapipython/docs/spotifywebapiPython/spotifydiscovery.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/spotifywebapiauthenticationerror.html +2 -2
- spotifywebapipython/docs/spotifywebapiPython/spotifywebapierror.html +2 -2
- spotifywebapipython/spotifyclient.py +62 -9
- {spotifywebapiPython-1.0.34.dist-info → spotifywebapiPython-1.0.36.dist-info}/LICENSE +0 -0
- {spotifywebapiPython-1.0.34.dist-info → spotifywebapiPython-1.0.36.dist-info}/WHEEL +0 -0
- {spotifywebapiPython-1.0.34.dist-info → spotifywebapiPython-1.0.36.dist-info}/top_level.txt +0 -0
|
@@ -484,6 +484,26 @@ class SpotifyClient:
|
|
|
484
484
|
msg.ResponseData = responseData
|
|
485
485
|
|
|
486
486
|
|
|
487
|
+
def _GetPlayerNowPlayingUri(self) -> str:
|
|
488
|
+
"""
|
|
489
|
+
Returns the uri value of the currently playing media if something is
|
|
490
|
+
playing; otherwise, null is returned.
|
|
491
|
+
"""
|
|
492
|
+
result:str = None
|
|
493
|
+
|
|
494
|
+
# get nowplaying status.
|
|
495
|
+
_logsi.LogVerbose("Querying NowPlaying status of Spotify player")
|
|
496
|
+
nowPlaying:PlayerPlayState = self.GetPlayerNowPlaying()
|
|
497
|
+
|
|
498
|
+
# is anything playing? if so, return the uri value.
|
|
499
|
+
if nowPlaying is not None:
|
|
500
|
+
_logsi.LogVerbose("NowPlaying data: %s" % str(nowPlaying))
|
|
501
|
+
if nowPlaying.Item is not None:
|
|
502
|
+
result = nowPlaying.Item.Uri
|
|
503
|
+
|
|
504
|
+
return result
|
|
505
|
+
|
|
506
|
+
|
|
487
507
|
def _ValidateMarket(self,
|
|
488
508
|
market:str,
|
|
489
509
|
) -> str:
|
|
@@ -823,9 +843,6 @@ class SpotifyClient:
|
|
|
823
843
|
else:
|
|
824
844
|
break
|
|
825
845
|
|
|
826
|
-
# reset buffer position for read.
|
|
827
|
-
#fData.seek(0)
|
|
828
|
-
|
|
829
846
|
# execute spotify web api request.
|
|
830
847
|
msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/playlists/{playlist_id}/images'.format(playlist_id=playlistId))
|
|
831
848
|
msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
|
|
@@ -869,7 +886,8 @@ class SpotifyClient:
|
|
|
869
886
|
uris (str):
|
|
870
887
|
A comma-separated list of Spotify URIs to add; can be track or episode URIs.
|
|
871
888
|
Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:512ojhOuo1ktJprKbVcKyQ`.
|
|
872
|
-
A maximum of 100 items can be
|
|
889
|
+
A maximum of 100 items can be specified in one request.
|
|
890
|
+
If null, the currently playing context uri value is used.
|
|
873
891
|
position (int):
|
|
874
892
|
The position to insert the items, a zero-based index.
|
|
875
893
|
For example, to insert the items in the first position: position=0;
|
|
@@ -907,6 +925,12 @@ class SpotifyClient:
|
|
|
907
925
|
apiMethodParms.AppendKeyValue("position", position)
|
|
908
926
|
_logsi.LogMethodParmList(SILevel.Verbose, "Add items to a user's playlist", apiMethodParms)
|
|
909
927
|
|
|
928
|
+
# if uris not specified, then return currently playing uri value.
|
|
929
|
+
if (uris is None) or (len(uris.strip()) == 0):
|
|
930
|
+
uris = self._GetPlayerNowPlayingUri()
|
|
931
|
+
if uris is None:
|
|
932
|
+
raise SpotifyApiError(SAAppMessages.ARGUMENT_REQUIRED_ERROR % (apiMethodName, 'uris'), logsi=_logsi)
|
|
933
|
+
|
|
910
934
|
# build a list of all item uri's.
|
|
911
935
|
# remove any leading / trailing spaces in case user put a space between the items.
|
|
912
936
|
arrUris:list[str] = uris.split(',')
|
|
@@ -934,6 +958,7 @@ class SpotifyClient:
|
|
|
934
958
|
_logsi.LogString(SILevel.Verbose, TRACE_METHOD_RESULT % apiMethodName, result)
|
|
935
959
|
return result
|
|
936
960
|
|
|
961
|
+
except SpotifyApiError: raise # pass handled exceptions on thru
|
|
937
962
|
except SpotifyWebApiError: raise # pass handled exceptions on thru
|
|
938
963
|
except SpotifyWebApiAuthenticationError: raise # pass handled exceptions on thru
|
|
939
964
|
except Exception as ex:
|
|
@@ -9699,7 +9724,7 @@ class SpotifyClient:
|
|
|
9699
9724
|
|
|
9700
9725
|
def RemovePlaylistItems(self,
|
|
9701
9726
|
playlistId:str,
|
|
9702
|
-
uris:str,
|
|
9727
|
+
uris:str=None,
|
|
9703
9728
|
snapshotId:str=None
|
|
9704
9729
|
) -> str:
|
|
9705
9730
|
"""
|
|
@@ -9715,7 +9740,8 @@ class SpotifyClient:
|
|
|
9715
9740
|
uris (str):
|
|
9716
9741
|
A comma-separated list of Spotify URIs to remove; can be track or episode URIs.
|
|
9717
9742
|
Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:512ojhOuo1ktJprKbVcKyQ`.
|
|
9718
|
-
A maximum of 100 items can be
|
|
9743
|
+
A maximum of 100 items can be specified in one request.
|
|
9744
|
+
If null, the currently playing context uri value is used.
|
|
9719
9745
|
snapshotId (str):
|
|
9720
9746
|
The playlist's snapshot ID against which you want to make the changes.
|
|
9721
9747
|
The API will validate that the specified items exist and in the specified positions and
|
|
@@ -9756,6 +9782,12 @@ class SpotifyClient:
|
|
|
9756
9782
|
apiMethodParms.AppendKeyValue("snapshotId", snapshotId)
|
|
9757
9783
|
_logsi.LogMethodParmList(SILevel.Verbose, "Remove item(s) from a user's playlist", apiMethodParms)
|
|
9758
9784
|
|
|
9785
|
+
# if uris not specified, then return currently playing uri value.
|
|
9786
|
+
if (uris is None) or (len(uris.strip()) == 0):
|
|
9787
|
+
uris = self._GetPlayerNowPlayingUri()
|
|
9788
|
+
if uris is None:
|
|
9789
|
+
raise SpotifyApiError(SAAppMessages.ARGUMENT_REQUIRED_ERROR % (apiMethodName, 'uris'), logsi=_logsi)
|
|
9790
|
+
|
|
9759
9791
|
# build a list of all item uri's.
|
|
9760
9792
|
# remove any leading / trailing spaces in case user put a space between the items.
|
|
9761
9793
|
arrUris:list[str] = uris.split(',')
|
|
@@ -9788,6 +9820,7 @@ class SpotifyClient:
|
|
|
9788
9820
|
_logsi.LogString(SILevel.Verbose, TRACE_METHOD_RESULT % apiMethodName, result)
|
|
9789
9821
|
return result
|
|
9790
9822
|
|
|
9823
|
+
except SpotifyApiError: raise # pass handled exceptions on thru
|
|
9791
9824
|
except SpotifyWebApiError: raise # pass handled exceptions on thru
|
|
9792
9825
|
except SpotifyWebApiAuthenticationError: raise # pass handled exceptions on thru
|
|
9793
9826
|
except Exception as ex:
|
|
@@ -9881,7 +9914,7 @@ class SpotifyClient:
|
|
|
9881
9914
|
|
|
9882
9915
|
|
|
9883
9916
|
def RemoveTrackFavorites(self,
|
|
9884
|
-
ids:str
|
|
9917
|
+
ids:str=None
|
|
9885
9918
|
) -> None:
|
|
9886
9919
|
"""
|
|
9887
9920
|
Remove one or more tracks from the current user's 'Your Library'.
|
|
@@ -9893,6 +9926,7 @@ class SpotifyClient:
|
|
|
9893
9926
|
A comma-separated list of the Spotify IDs for the tracks.
|
|
9894
9927
|
Maximum: 50 IDs.
|
|
9895
9928
|
Example: `1kWUud3vY5ij5r62zxpTRy,4eoYKv2kDwJS7gRGh5q6SK`
|
|
9929
|
+
If null, the currently playing context uri id value is used.
|
|
9896
9930
|
|
|
9897
9931
|
Raises:
|
|
9898
9932
|
SpotifyWebApiError:
|
|
@@ -9924,6 +9958,14 @@ class SpotifyClient:
|
|
|
9924
9958
|
apiMethodParms.AppendKeyValue("ids", ids)
|
|
9925
9959
|
_logsi.LogMethodParmList(SILevel.Verbose, "Remove track(s) from user favorites", apiMethodParms)
|
|
9926
9960
|
|
|
9961
|
+
# if ids not specified, then return currently playing id value.
|
|
9962
|
+
if (ids is None) or (len(ids.strip()) == 0):
|
|
9963
|
+
uri = self._GetPlayerNowPlayingUri()
|
|
9964
|
+
if uri is not None:
|
|
9965
|
+
ids = SpotifyClient.GetIdFromUri(uri)
|
|
9966
|
+
else:
|
|
9967
|
+
raise SpotifyApiError(SAAppMessages.ARGUMENT_REQUIRED_ERROR % (apiMethodName, 'ids'), logsi=_logsi)
|
|
9968
|
+
|
|
9927
9969
|
# build a list of all item id's.
|
|
9928
9970
|
# remove any leading / trailing spaces in case user put a space between the items.
|
|
9929
9971
|
arrIds:list[str] = ids.split(',')
|
|
@@ -9946,6 +9988,7 @@ class SpotifyClient:
|
|
|
9946
9988
|
# no results to process - this is pass or fail.
|
|
9947
9989
|
return
|
|
9948
9990
|
|
|
9991
|
+
except SpotifyApiError: raise # pass handled exceptions on thru
|
|
9949
9992
|
except SpotifyWebApiError: raise # pass handled exceptions on thru
|
|
9950
9993
|
except SpotifyWebApiAuthenticationError: raise # pass handled exceptions on thru
|
|
9951
9994
|
except Exception as ex:
|
|
@@ -10090,7 +10133,7 @@ class SpotifyClient:
|
|
|
10090
10133
|
uris (str):
|
|
10091
10134
|
A comma-separated list of Spotify URIs to replace; can be track or episode URIs.
|
|
10092
10135
|
Example: `spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:512ojhOuo1ktJprKbVcKyQ`.
|
|
10093
|
-
A maximum of 100 items can be
|
|
10136
|
+
A maximum of 100 items can be specified in one request.
|
|
10094
10137
|
|
|
10095
10138
|
Returns:
|
|
10096
10139
|
A snapshot ID for the updated playlist.
|
|
@@ -10476,7 +10519,7 @@ class SpotifyClient:
|
|
|
10476
10519
|
|
|
10477
10520
|
|
|
10478
10521
|
def SaveTrackFavorites(self,
|
|
10479
|
-
ids:str
|
|
10522
|
+
ids:str=None
|
|
10480
10523
|
) -> None:
|
|
10481
10524
|
"""
|
|
10482
10525
|
Save one or more tracks to the current user's 'Your Library'.
|
|
@@ -10488,6 +10531,7 @@ class SpotifyClient:
|
|
|
10488
10531
|
A comma-separated list of the Spotify IDs for the tracks.
|
|
10489
10532
|
Maximum: 50 IDs.
|
|
10490
10533
|
Example: `6vc9OTcyd3hyzabCmsdnwE,382ObEPsp2rxGrnsizN5TX,2noRn2Aes5aoNVsU6iWThc`
|
|
10534
|
+
If null, the currently playing context uri id value is used.
|
|
10491
10535
|
|
|
10492
10536
|
Raises:
|
|
10493
10537
|
SpotifyWebApiError:
|
|
@@ -10519,6 +10563,14 @@ class SpotifyClient:
|
|
|
10519
10563
|
apiMethodParms.AppendKeyValue("ids", ids)
|
|
10520
10564
|
_logsi.LogMethodParmList(SILevel.Verbose, "Save track(s) to user favorites", apiMethodParms)
|
|
10521
10565
|
|
|
10566
|
+
# if ids not specified, then return currently playing id value.
|
|
10567
|
+
if (ids is None) or (len(ids.strip()) == 0):
|
|
10568
|
+
uri = self._GetPlayerNowPlayingUri()
|
|
10569
|
+
if uri is not None:
|
|
10570
|
+
ids = SpotifyClient.GetIdFromUri(uri)
|
|
10571
|
+
else:
|
|
10572
|
+
raise SpotifyApiError(SAAppMessages.ARGUMENT_REQUIRED_ERROR % (apiMethodName, 'ids'), logsi=_logsi)
|
|
10573
|
+
|
|
10522
10574
|
# build a list of all item id's.
|
|
10523
10575
|
# remove any leading / trailing spaces in case user put a space between the items.
|
|
10524
10576
|
arrIds:list[str] = ids.split(',')
|
|
@@ -10541,6 +10593,7 @@ class SpotifyClient:
|
|
|
10541
10593
|
# no results to process - this is pass or fail.
|
|
10542
10594
|
return
|
|
10543
10595
|
|
|
10596
|
+
except SpotifyApiError: raise # pass handled exceptions on thru
|
|
10544
10597
|
except SpotifyWebApiError: raise # pass handled exceptions on thru
|
|
10545
10598
|
except SpotifyWebApiAuthenticationError: raise # pass handled exceptions on thru
|
|
10546
10599
|
except Exception as ex:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|