spotifywebapiPython 1.0.284__py3-none-any.whl → 1.0.286__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.
- spotifywebapipython/const.py +1 -1
- spotifywebapipython/docs/__init__.html +14 -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 +29 -11
- spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifymediatypes.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifytypeprefixes.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/models/searchresponse.py +107 -4
- spotifywebapipython/spotifyclient.py +244 -15
- {spotifywebapipython-1.0.284.dist-info → spotifywebapipython-1.0.286.dist-info}/METADATA +1 -1
- {spotifywebapipython-1.0.284.dist-info → spotifywebapipython-1.0.286.dist-info}/RECORD +24 -24
- {spotifywebapipython-1.0.284.dist-info → spotifywebapipython-1.0.286.dist-info}/LICENSE +0 -0
- {spotifywebapipython-1.0.284.dist-info → spotifywebapipython-1.0.286.dist-info}/WHEEL +0 -0
- {spotifywebapipython-1.0.284.dist-info → spotifywebapipython-1.0.286.dist-info}/top_level.txt +0 -0
|
@@ -3674,6 +3674,7 @@ class SpotifyClient:
|
|
|
3674
3674
|
market:str=None,
|
|
3675
3675
|
limitTotal:int=None,
|
|
3676
3676
|
sortResult:bool=True,
|
|
3677
|
+
filterCriteria:str|None=None,
|
|
3677
3678
|
) -> AlbumPageSaved:
|
|
3678
3679
|
"""
|
|
3679
3680
|
Get a list of the albums saved in the current Spotify user's 'Your Library'.
|
|
@@ -3707,6 +3708,9 @@ class SpotifyClient:
|
|
|
3707
3708
|
True to sort the items by name; otherwise, False to leave the items in the same order they
|
|
3708
3709
|
were returned in by the Spotify Web API.
|
|
3709
3710
|
Default: True
|
|
3711
|
+
filterCriteria (str):
|
|
3712
|
+
Filter returned entries by a album name or uri value.
|
|
3713
|
+
Value can be a full name (e.g. "My Album Name"), or a partial name (e.g. "My").
|
|
3710
3714
|
|
|
3711
3715
|
Returns:
|
|
3712
3716
|
An `AlbumPageSaved` object that contains saved album information.
|
|
@@ -3744,6 +3748,7 @@ class SpotifyClient:
|
|
|
3744
3748
|
apiMethodParms.AppendKeyValue("market", market)
|
|
3745
3749
|
apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
|
|
3746
3750
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
3751
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
3747
3752
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the user's album favorites", apiMethodParms)
|
|
3748
3753
|
|
|
3749
3754
|
# validations.
|
|
@@ -3817,13 +3822,32 @@ class SpotifyClient:
|
|
|
3817
3822
|
result.Total = pageObj.Total
|
|
3818
3823
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
3819
3824
|
|
|
3820
|
-
#
|
|
3825
|
+
# any results to process?
|
|
3821
3826
|
if (len(result.Items) > 0):
|
|
3827
|
+
|
|
3828
|
+
# sort result items.
|
|
3822
3829
|
if (sortResult is True):
|
|
3823
3830
|
result.Items.sort(key=lambda x: (x.Album.Name or "").lower(), reverse=False)
|
|
3824
3831
|
else:
|
|
3825
3832
|
result.Items.sort(key=lambda x: (x.AddedAt or "").lower(), reverse=True)
|
|
3826
3833
|
|
|
3834
|
+
# apply filter criteria (if specified).
|
|
3835
|
+
if (filterCriteria is not None):
|
|
3836
|
+
_logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
|
|
3837
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
3838
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
3839
|
+
# process list in reverse order since we are removing items.
|
|
3840
|
+
for idx in reversed(range(len(result.Items))):
|
|
3841
|
+
item:AlbumSaved = result.Items[idx]
|
|
3842
|
+
itemFound:bool = False
|
|
3843
|
+
if (isFilterUri):
|
|
3844
|
+
if ((item.Album.Uri or "").lower() == filterCriteriaCompare):
|
|
3845
|
+
itemFound = True
|
|
3846
|
+
elif ((item.Album.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
3847
|
+
itemFound = True
|
|
3848
|
+
if (not itemFound):
|
|
3849
|
+
result.Items.pop(idx)
|
|
3850
|
+
|
|
3827
3851
|
# trace.
|
|
3828
3852
|
_logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
3829
3853
|
return result
|
|
@@ -3849,6 +3873,7 @@ class SpotifyClient:
|
|
|
3849
3873
|
country:str=None,
|
|
3850
3874
|
limitTotal:int=None,
|
|
3851
3875
|
sortResult:bool=True,
|
|
3876
|
+
filterCriteria:str|None=None,
|
|
3852
3877
|
) -> AlbumPageSimplified:
|
|
3853
3878
|
"""
|
|
3854
3879
|
<span class="deprecated">
|
|
@@ -3886,6 +3911,9 @@ class SpotifyClient:
|
|
|
3886
3911
|
True to sort the items by name; otherwise, False to leave the items in the same order they
|
|
3887
3912
|
were returned in by the Spotify Web API.
|
|
3888
3913
|
Default: True
|
|
3914
|
+
filterCriteria (str):
|
|
3915
|
+
Filter returned entries by a album name or uri value.
|
|
3916
|
+
Value can be a full name (e.g. "My Album Name"), or a partial name (e.g. "My").
|
|
3889
3917
|
|
|
3890
3918
|
Returns:
|
|
3891
3919
|
An `AlbumPageSimplified` object that contains simplified album information.
|
|
@@ -3923,6 +3951,7 @@ class SpotifyClient:
|
|
|
3923
3951
|
apiMethodParms.AppendKeyValue("country", country)
|
|
3924
3952
|
apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
|
|
3925
3953
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
3954
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
3926
3955
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of new album releases", apiMethodParms)
|
|
3927
3956
|
|
|
3928
3957
|
# are spotify web player credentials configured? if so, then we will use them to create
|
|
@@ -3997,11 +4026,30 @@ class SpotifyClient:
|
|
|
3997
4026
|
result.Total = pageObj.Total
|
|
3998
4027
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
3999
4028
|
|
|
4000
|
-
#
|
|
4029
|
+
# any results to process?
|
|
4001
4030
|
if (len(result.Items) > 0):
|
|
4031
|
+
|
|
4032
|
+
# sort result items.
|
|
4002
4033
|
if (sortResult is True):
|
|
4003
4034
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
4004
4035
|
|
|
4036
|
+
# apply filter criteria (if specified).
|
|
4037
|
+
if (filterCriteria is not None):
|
|
4038
|
+
_logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
|
|
4039
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
4040
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
4041
|
+
# process list in reverse order since we are removing items.
|
|
4042
|
+
for idx in reversed(range(len(result.Items))):
|
|
4043
|
+
item:AlbumSimplified = result.Items[idx]
|
|
4044
|
+
itemFound:bool = False
|
|
4045
|
+
if (isFilterUri):
|
|
4046
|
+
if ((item.Uri or "").lower() == filterCriteriaCompare):
|
|
4047
|
+
itemFound = True
|
|
4048
|
+
elif ((item.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
4049
|
+
itemFound = True
|
|
4050
|
+
if (not itemFound):
|
|
4051
|
+
result.Items.pop(idx)
|
|
4052
|
+
|
|
4005
4053
|
# trace.
|
|
4006
4054
|
_logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
4007
4055
|
return result
|
|
@@ -4551,8 +4599,10 @@ class SpotifyClient:
|
|
|
4551
4599
|
result.Total = pageObj.Total
|
|
4552
4600
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
4553
4601
|
|
|
4554
|
-
#
|
|
4602
|
+
# any results to process?
|
|
4555
4603
|
if (len(result.Items) > 0):
|
|
4604
|
+
|
|
4605
|
+
# sort result items.
|
|
4556
4606
|
if (sortResult is True):
|
|
4557
4607
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
4558
4608
|
|
|
@@ -5116,6 +5166,7 @@ class SpotifyClient:
|
|
|
5116
5166
|
limit:int=20,
|
|
5117
5167
|
limitTotal:int=None,
|
|
5118
5168
|
sortResult:bool=True,
|
|
5169
|
+
filterCriteria:str|None=None,
|
|
5119
5170
|
) -> ArtistPage:
|
|
5120
5171
|
"""
|
|
5121
5172
|
Get the current user's followed artists.
|
|
@@ -5139,6 +5190,9 @@ class SpotifyClient:
|
|
|
5139
5190
|
True to sort the items by name; otherwise, False to leave the items in the same order they
|
|
5140
5191
|
were returned in by the Spotify Web API.
|
|
5141
5192
|
Default: True
|
|
5193
|
+
filterCriteria (str):
|
|
5194
|
+
Filter returned entries by a audiobook name or uri value.
|
|
5195
|
+
Value can be a full name (e.g. "My AudioBook Name"), or a partial name (e.g. "My").
|
|
5142
5196
|
|
|
5143
5197
|
Returns:
|
|
5144
5198
|
An `ArtistPage` object of matching results.
|
|
@@ -5175,6 +5229,7 @@ class SpotifyClient:
|
|
|
5175
5229
|
apiMethodParms.AppendKeyValue("limit", limit)
|
|
5176
5230
|
apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
|
|
5177
5231
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
5232
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
5178
5233
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get the current user's followed artists", apiMethodParms)
|
|
5179
5234
|
|
|
5180
5235
|
# validations.
|
|
@@ -5250,11 +5305,30 @@ class SpotifyClient:
|
|
|
5250
5305
|
result.CursorAfter = pageObj.CursorAfter
|
|
5251
5306
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
5252
5307
|
|
|
5253
|
-
#
|
|
5308
|
+
# any results to process?
|
|
5254
5309
|
if (len(result.Items) > 0):
|
|
5310
|
+
|
|
5311
|
+
# sort result items.
|
|
5255
5312
|
if (sortResult is True):
|
|
5256
5313
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
5257
5314
|
|
|
5315
|
+
# apply filter criteria (if specified).
|
|
5316
|
+
if (filterCriteria is not None):
|
|
5317
|
+
_logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
|
|
5318
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
5319
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
5320
|
+
# process list in reverse order since we are removing items.
|
|
5321
|
+
for idx in reversed(range(len(result.Items))):
|
|
5322
|
+
item:Artist = result.Items[idx]
|
|
5323
|
+
itemFound:bool = False
|
|
5324
|
+
if (isFilterUri):
|
|
5325
|
+
if ((item.Uri or "").lower() == filterCriteriaCompare):
|
|
5326
|
+
itemFound = True
|
|
5327
|
+
elif ((item.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
5328
|
+
itemFound = True
|
|
5329
|
+
if (not itemFound):
|
|
5330
|
+
result.Items.pop(idx)
|
|
5331
|
+
|
|
5258
5332
|
# trace.
|
|
5259
5333
|
_logsi.LogObject(SILevel.Verbose, TRACE_METHOD_RESULT_TYPE % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
5260
5334
|
return result
|
|
@@ -5687,6 +5761,7 @@ class SpotifyClient:
|
|
|
5687
5761
|
offset:int=0,
|
|
5688
5762
|
limitTotal:int=None,
|
|
5689
5763
|
sortResult:bool=True,
|
|
5764
|
+
filterCriteria:str|None=None,
|
|
5690
5765
|
) -> AudiobookPageSimplified:
|
|
5691
5766
|
"""
|
|
5692
5767
|
Get a list of the audiobooks saved in the current Spotify user's 'Your Library'.
|
|
@@ -5712,6 +5787,9 @@ class SpotifyClient:
|
|
|
5712
5787
|
True to sort the items by name; otherwise, False to leave the items in the same order they
|
|
5713
5788
|
were returned in by the Spotify Web API.
|
|
5714
5789
|
Default: True
|
|
5790
|
+
filterCriteria (str):
|
|
5791
|
+
Filter returned entries by a audiobook name or uri value.
|
|
5792
|
+
Value can be a full name (e.g. "My AudioBook Name"), or a partial name (e.g. "My").
|
|
5715
5793
|
|
|
5716
5794
|
Returns:
|
|
5717
5795
|
An `AudiobookPageSimplified` object that contains saved audiobook information.
|
|
@@ -5748,6 +5826,7 @@ class SpotifyClient:
|
|
|
5748
5826
|
apiMethodParms.AppendKeyValue("offset", offset)
|
|
5749
5827
|
apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
|
|
5750
5828
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
5829
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
5751
5830
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users audiobook favorites", apiMethodParms)
|
|
5752
5831
|
|
|
5753
5832
|
# validations.
|
|
@@ -5814,11 +5893,30 @@ class SpotifyClient:
|
|
|
5814
5893
|
result.Total = pageObj.Total
|
|
5815
5894
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
5816
5895
|
|
|
5817
|
-
#
|
|
5896
|
+
# any results to process?
|
|
5818
5897
|
if (len(result.Items) > 0):
|
|
5898
|
+
|
|
5899
|
+
# sort result items.
|
|
5819
5900
|
if (sortResult is True):
|
|
5820
5901
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
5821
5902
|
|
|
5903
|
+
# apply filter criteria (if specified).
|
|
5904
|
+
if (filterCriteria is not None):
|
|
5905
|
+
_logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
|
|
5906
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
5907
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
5908
|
+
# process list in reverse order since we are removing items.
|
|
5909
|
+
for idx in reversed(range(len(result.Items))):
|
|
5910
|
+
item:AudiobookSimplified = result.Items[idx]
|
|
5911
|
+
itemFound:bool = False
|
|
5912
|
+
if (isFilterUri):
|
|
5913
|
+
if ((item.Uri or "").lower() == filterCriteriaCompare):
|
|
5914
|
+
itemFound = True
|
|
5915
|
+
elif ((item.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
5916
|
+
itemFound = True
|
|
5917
|
+
if (not itemFound):
|
|
5918
|
+
result.Items.pop(idx)
|
|
5919
|
+
|
|
5822
5920
|
# trace.
|
|
5823
5921
|
_logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
5824
5922
|
return result
|
|
@@ -6260,8 +6358,10 @@ class SpotifyClient:
|
|
|
6260
6358
|
result.Total = pageObj.Total
|
|
6261
6359
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
6262
6360
|
|
|
6263
|
-
#
|
|
6361
|
+
# any results to process?
|
|
6264
6362
|
if (len(result.Items) > 0):
|
|
6363
|
+
|
|
6364
|
+
# sort result items.
|
|
6265
6365
|
if (sortResult is True):
|
|
6266
6366
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
6267
6367
|
|
|
@@ -6569,8 +6669,10 @@ class SpotifyClient:
|
|
|
6569
6669
|
result.Total = pageObj.Total
|
|
6570
6670
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
6571
6671
|
|
|
6572
|
-
#
|
|
6672
|
+
# any results to process?
|
|
6573
6673
|
if (len(result.Items) > 0):
|
|
6674
|
+
|
|
6675
|
+
# sort result items.
|
|
6574
6676
|
if (sortResult is True):
|
|
6575
6677
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
6576
6678
|
|
|
@@ -7169,6 +7271,7 @@ class SpotifyClient:
|
|
|
7169
7271
|
offset:int=0,
|
|
7170
7272
|
limitTotal:int=None,
|
|
7171
7273
|
sortResult:bool=True,
|
|
7274
|
+
filterCriteria:str|None=None,
|
|
7172
7275
|
) -> EpisodePageSaved:
|
|
7173
7276
|
"""
|
|
7174
7277
|
Get a list of the episodes saved in the current Spotify user's 'Your Library'.
|
|
@@ -7194,6 +7297,9 @@ class SpotifyClient:
|
|
|
7194
7297
|
True to sort the items by name; otherwise, False to leave the items in the same order they
|
|
7195
7298
|
were returned in by the Spotify Web API.
|
|
7196
7299
|
Default: True
|
|
7300
|
+
filterCriteria (str):
|
|
7301
|
+
Filter returned entries by a episode name or uri value.
|
|
7302
|
+
Value can be a full name (e.g. "My Episode Name"), or a partial name (e.g. "My").
|
|
7197
7303
|
|
|
7198
7304
|
Returns:
|
|
7199
7305
|
An `EpisodePageSaved` object that contains saved episode information.
|
|
@@ -7230,6 +7336,7 @@ class SpotifyClient:
|
|
|
7230
7336
|
apiMethodParms.AppendKeyValue("offset", offset)
|
|
7231
7337
|
apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
|
|
7232
7338
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
7339
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
7233
7340
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users episode favorites", apiMethodParms)
|
|
7234
7341
|
|
|
7235
7342
|
# validations.
|
|
@@ -7298,13 +7405,32 @@ class SpotifyClient:
|
|
|
7298
7405
|
result.Total = pageObj.Total
|
|
7299
7406
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
7300
7407
|
|
|
7301
|
-
#
|
|
7408
|
+
# any results to process?
|
|
7302
7409
|
if (len(result.Items) > 0):
|
|
7410
|
+
|
|
7411
|
+
# sort result items.
|
|
7303
7412
|
if (sortResult is True):
|
|
7304
7413
|
result.Items.sort(key=lambda x: (x.Episode.Name or "").lower(), reverse=False)
|
|
7305
7414
|
else:
|
|
7306
7415
|
result.Items.sort(key=lambda x: (x.AddedAt or "").lower(), reverse=True)
|
|
7307
7416
|
|
|
7417
|
+
# apply filter criteria (if specified).
|
|
7418
|
+
if (filterCriteria is not None):
|
|
7419
|
+
_logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
|
|
7420
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
7421
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
7422
|
+
# process list in reverse order since we are removing items.
|
|
7423
|
+
for idx in reversed(range(len(result.Items))):
|
|
7424
|
+
item:EpisodeSaved = result.Items[idx]
|
|
7425
|
+
itemFound:bool = False
|
|
7426
|
+
if (isFilterUri):
|
|
7427
|
+
if ((item.Episode.Uri or "").lower() == filterCriteriaCompare):
|
|
7428
|
+
itemFound = True
|
|
7429
|
+
elif ((item.Episode.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
7430
|
+
itemFound = True
|
|
7431
|
+
if (not itemFound):
|
|
7432
|
+
result.Items.pop(idx)
|
|
7433
|
+
|
|
7308
7434
|
# trace.
|
|
7309
7435
|
_logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
7310
7436
|
return result
|
|
@@ -7618,8 +7744,10 @@ class SpotifyClient:
|
|
|
7618
7744
|
result.Total = pageObj.Total
|
|
7619
7745
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
7620
7746
|
|
|
7621
|
-
#
|
|
7747
|
+
# any results to process?
|
|
7622
7748
|
if (len(result.Items) > 0):
|
|
7749
|
+
|
|
7750
|
+
# sort result items.
|
|
7623
7751
|
if (sortResult is True):
|
|
7624
7752
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
7625
7753
|
|
|
@@ -9223,7 +9351,8 @@ class SpotifyClient:
|
|
|
9223
9351
|
limit:int=50,
|
|
9224
9352
|
after:int=None,
|
|
9225
9353
|
before:int=None,
|
|
9226
|
-
limitTotal:int=None
|
|
9354
|
+
limitTotal:int=None,
|
|
9355
|
+
filterCriteria:str|None=None,
|
|
9227
9356
|
) -> PlayHistoryPage:
|
|
9228
9357
|
"""
|
|
9229
9358
|
Get tracks from the current user's recently played tracks.
|
|
@@ -9254,6 +9383,9 @@ class SpotifyClient:
|
|
|
9254
9383
|
and paging is automatically used to retrieve all available items up to the
|
|
9255
9384
|
maximum number specified.
|
|
9256
9385
|
Default: None (disabled)
|
|
9386
|
+
filterCriteria (str):
|
|
9387
|
+
Filter returned entries by a track name or uri value.
|
|
9388
|
+
Value can be a full name (e.g. "My Track Name"), or a partial name (e.g. "My").
|
|
9257
9389
|
|
|
9258
9390
|
Spotify currently limits the maximum number of items returned to 50 no matter what you
|
|
9259
9391
|
supply for the `limitTotal` argument.
|
|
@@ -9299,6 +9431,7 @@ class SpotifyClient:
|
|
|
9299
9431
|
apiMethodParms.AppendKeyValue("after", after)
|
|
9300
9432
|
apiMethodParms.AppendKeyValue("before", before)
|
|
9301
9433
|
apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
|
|
9434
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
9302
9435
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get tracks from the current user's recently played tracks", apiMethodParms)
|
|
9303
9436
|
|
|
9304
9437
|
# validations.
|
|
@@ -9388,6 +9521,26 @@ class SpotifyClient:
|
|
|
9388
9521
|
result.CursorBefore = pageObj.CursorBefore
|
|
9389
9522
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
9390
9523
|
|
|
9524
|
+
# any results to process?
|
|
9525
|
+
if (len(result.Items) > 0):
|
|
9526
|
+
|
|
9527
|
+
# apply filter criteria (if specified).
|
|
9528
|
+
if (filterCriteria is not None):
|
|
9529
|
+
_logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
|
|
9530
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
9531
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
9532
|
+
# process list in reverse order since we are removing items.
|
|
9533
|
+
for idx in reversed(range(len(result.Items))):
|
|
9534
|
+
item:PlayHistory = result.Items[idx]
|
|
9535
|
+
itemFound:bool = False
|
|
9536
|
+
if (isFilterUri):
|
|
9537
|
+
if ((item.Track.Uri or "").lower() == filterCriteriaCompare):
|
|
9538
|
+
itemFound = True
|
|
9539
|
+
elif ((item.Track.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
9540
|
+
itemFound = True
|
|
9541
|
+
if (not itemFound):
|
|
9542
|
+
result.Items.pop(idx)
|
|
9543
|
+
|
|
9391
9544
|
# trace.
|
|
9392
9545
|
_logsi.LogObject(SILevel.Verbose, TRACE_METHOD_RESULT_TYPE % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
9393
9546
|
return result
|
|
@@ -9888,6 +10041,7 @@ class SpotifyClient:
|
|
|
9888
10041
|
offset:int=0,
|
|
9889
10042
|
limitTotal:int=None,
|
|
9890
10043
|
sortResult:bool=True,
|
|
10044
|
+
filterCriteria:str|None=None,
|
|
9891
10045
|
) -> PlaylistPageSimplified:
|
|
9892
10046
|
"""
|
|
9893
10047
|
Get a list of the playlists owned or followed by the current Spotify user.
|
|
@@ -9913,6 +10067,9 @@ class SpotifyClient:
|
|
|
9913
10067
|
True to sort the items by name; otherwise, False to leave the items in the same order they
|
|
9914
10068
|
were returned in by the Spotify Web API.
|
|
9915
10069
|
Default: True
|
|
10070
|
+
filterCriteria (str):
|
|
10071
|
+
Filter returned entries by a playlist name or uri value.
|
|
10072
|
+
Value can be a full name (e.g. "My Playlist Name"), or a partial name (e.g. "My").
|
|
9916
10073
|
|
|
9917
10074
|
Returns:
|
|
9918
10075
|
An `PlaylistPageSimplified` object that contains playlist information.
|
|
@@ -9958,6 +10115,7 @@ class SpotifyClient:
|
|
|
9958
10115
|
apiMethodParms.AppendKeyValue("offset", offset)
|
|
9959
10116
|
apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
|
|
9960
10117
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
10118
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
9961
10119
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users playlist favorites", apiMethodParms)
|
|
9962
10120
|
|
|
9963
10121
|
# are spotify web player credentials configured? if so, then we will use them to create
|
|
@@ -10028,10 +10186,29 @@ class SpotifyClient:
|
|
|
10028
10186
|
result.Total = pageObj.Total
|
|
10029
10187
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
10030
10188
|
|
|
10031
|
-
#
|
|
10189
|
+
# any results to process?
|
|
10032
10190
|
if (len(result.Items) > 0):
|
|
10191
|
+
|
|
10192
|
+
# sort result items.
|
|
10033
10193
|
if (sortResult is True):
|
|
10034
10194
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
10195
|
+
|
|
10196
|
+
# apply filter criteria (if specified).
|
|
10197
|
+
if (filterCriteria is not None):
|
|
10198
|
+
_logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
|
|
10199
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
10200
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
10201
|
+
# process list in reverse order since we are removing items.
|
|
10202
|
+
for idx in reversed(range(len(result.Items))):
|
|
10203
|
+
item:PlaylistSimplified = result.Items[idx]
|
|
10204
|
+
itemFound:bool = False
|
|
10205
|
+
if (isFilterUri):
|
|
10206
|
+
if ((item.Uri or "").lower() == filterCriteriaCompare):
|
|
10207
|
+
itemFound = True
|
|
10208
|
+
elif ((item.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
10209
|
+
itemFound = True
|
|
10210
|
+
if (not itemFound):
|
|
10211
|
+
result.Items.pop(idx)
|
|
10035
10212
|
|
|
10036
10213
|
# trace.
|
|
10037
10214
|
_logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
@@ -10202,8 +10379,10 @@ class SpotifyClient:
|
|
|
10202
10379
|
result.Total = pageObj.Total
|
|
10203
10380
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
10204
10381
|
|
|
10205
|
-
#
|
|
10382
|
+
# any results to process?
|
|
10206
10383
|
if (len(result.Items) > 0):
|
|
10384
|
+
|
|
10385
|
+
# sort result items.
|
|
10207
10386
|
if (sortResult is True):
|
|
10208
10387
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
10209
10388
|
|
|
@@ -10513,6 +10692,7 @@ class SpotifyClient:
|
|
|
10513
10692
|
limitTotal:int=None,
|
|
10514
10693
|
sortResult:bool=True,
|
|
10515
10694
|
excludeAudiobooks:bool=True,
|
|
10695
|
+
filterCriteria:str|None=None,
|
|
10516
10696
|
) -> ShowPageSaved:
|
|
10517
10697
|
"""
|
|
10518
10698
|
Get a list of the shows saved in the current Spotify user's 'Your Library'.
|
|
@@ -10542,6 +10722,9 @@ class SpotifyClient:
|
|
|
10542
10722
|
True to exclude audiobook shows from the returned list, leaving only podcast shows;
|
|
10543
10723
|
otherwise, False to include all results returned by the Spotify Web API.
|
|
10544
10724
|
Default: True
|
|
10725
|
+
filterCriteria (str):
|
|
10726
|
+
Filter returned entries by a show name or uri value.
|
|
10727
|
+
Value can be a full name (e.g. "My Show Name"), or a partial name (e.g. "My").
|
|
10545
10728
|
|
|
10546
10729
|
Returns:
|
|
10547
10730
|
An `ShowPageSaved` object that contains saved show information.
|
|
@@ -10584,6 +10767,7 @@ class SpotifyClient:
|
|
|
10584
10767
|
apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
|
|
10585
10768
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
10586
10769
|
apiMethodParms.AppendKeyValue("excludeAudiobooks", excludeAudiobooks)
|
|
10770
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
10587
10771
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users show favorites", apiMethodParms)
|
|
10588
10772
|
|
|
10589
10773
|
# validations.
|
|
@@ -10668,13 +10852,32 @@ class SpotifyClient:
|
|
|
10668
10852
|
result.Total = pageObj.Total
|
|
10669
10853
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
10670
10854
|
|
|
10671
|
-
#
|
|
10855
|
+
# any results to process?
|
|
10672
10856
|
if (len(result.Items) > 0):
|
|
10857
|
+
|
|
10858
|
+
# sort result items.
|
|
10673
10859
|
if (sortResult is True):
|
|
10674
10860
|
result.Items.sort(key=lambda x: (x.Show.Name or "").lower(), reverse=False)
|
|
10675
10861
|
else:
|
|
10676
10862
|
result.Items.sort(key=lambda x: (x.AddedAt or "").lower(), reverse=True)
|
|
10677
10863
|
|
|
10864
|
+
# apply filter criteria (if specified).
|
|
10865
|
+
if (filterCriteria is not None):
|
|
10866
|
+
_logsi.LogVerbose("Applying filter criteria to results list: \"%s\"" % (filterCriteria))
|
|
10867
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
10868
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
10869
|
+
# process list in reverse order since we are removing items.
|
|
10870
|
+
for idx in reversed(range(len(result.Items))):
|
|
10871
|
+
item:ShowSaved = result.Items[idx]
|
|
10872
|
+
itemFound:bool = False
|
|
10873
|
+
if (isFilterUri):
|
|
10874
|
+
if ((item.Show.Uri or "").lower() == filterCriteriaCompare):
|
|
10875
|
+
itemFound = True
|
|
10876
|
+
elif ((item.Show.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
10877
|
+
itemFound = True
|
|
10878
|
+
if (not itemFound):
|
|
10879
|
+
result.Items.pop(idx)
|
|
10880
|
+
|
|
10678
10881
|
# trace.
|
|
10679
10882
|
_logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
10680
10883
|
return result
|
|
@@ -11474,6 +11677,7 @@ class SpotifyClient:
|
|
|
11474
11677
|
sortResult:bool=True,
|
|
11475
11678
|
filterArtist:str=None,
|
|
11476
11679
|
filterAlbum:str=None,
|
|
11680
|
+
filterCriteria:str|None=None,
|
|
11477
11681
|
) -> TrackPageSaved:
|
|
11478
11682
|
"""
|
|
11479
11683
|
Get a list of the tracks saved in the current Spotify user's 'Your Library'.
|
|
@@ -11513,6 +11717,9 @@ class SpotifyClient:
|
|
|
11513
11717
|
filterAlbum (str):
|
|
11514
11718
|
Filter returned entries by an album name or uri value.
|
|
11515
11719
|
Value can be the full name of the album (e.g. "Carried Me"), or a partial name (e.g. "Carried").
|
|
11720
|
+
filterCriteria (str):
|
|
11721
|
+
Filter returned entries by a track name or uri value.
|
|
11722
|
+
Value can be a full name (e.g. "My Track Name"), or a partial name (e.g. "My").
|
|
11516
11723
|
|
|
11517
11724
|
Returns:
|
|
11518
11725
|
An `TrackPageSaved` object that contains saved track information.
|
|
@@ -11552,6 +11759,7 @@ class SpotifyClient:
|
|
|
11552
11759
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
11553
11760
|
apiMethodParms.AppendKeyValue("filterArtist", filterArtist)
|
|
11554
11761
|
apiMethodParms.AppendKeyValue("filterAlbum", filterAlbum)
|
|
11762
|
+
apiMethodParms.AppendKeyValue("filterCriteria", filterCriteria)
|
|
11555
11763
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users track favorites", apiMethodParms)
|
|
11556
11764
|
|
|
11557
11765
|
# validations.
|
|
@@ -11674,6 +11882,23 @@ class SpotifyClient:
|
|
|
11674
11882
|
if (not albumFound):
|
|
11675
11883
|
result.Items.pop(idx)
|
|
11676
11884
|
|
|
11885
|
+
# apply filter criteria (if specified).
|
|
11886
|
+
if (filterCriteria is not None):
|
|
11887
|
+
_logsi.LogVerbose("Applying filter criteria to results list: %s=\"%s\"" % ("track", filterCriteria))
|
|
11888
|
+
filterCriteriaCompare:str = (filterCriteria or "").lower()
|
|
11889
|
+
isFilterUri:bool = SpotifyClient.IsSpotifyUri(filterCriteriaCompare)
|
|
11890
|
+
# process list in reverse order since we are removing items.
|
|
11891
|
+
for idx in reversed(range(len(result.Items))):
|
|
11892
|
+
item:TrackSaved = result.Items[idx]
|
|
11893
|
+
itemFound:bool = False
|
|
11894
|
+
if (isFilterUri):
|
|
11895
|
+
if ((item.Track.Uri or "").lower() == filterCriteriaCompare):
|
|
11896
|
+
itemFound = True
|
|
11897
|
+
elif ((item.Track.Name or "").lower().find(filterCriteriaCompare) > -1):
|
|
11898
|
+
itemFound = True
|
|
11899
|
+
if (not itemFound):
|
|
11900
|
+
result.Items.pop(idx)
|
|
11901
|
+
|
|
11677
11902
|
# trace.
|
|
11678
11903
|
_logsi.LogObject(SILevel.Verbose, (TRACE_METHOD_RESULT_TYPE + result.PagingInfo) % (apiMethodName, type(result).__name__), result, excludeNonPublic=True)
|
|
11679
11904
|
return result
|
|
@@ -12674,8 +12899,10 @@ class SpotifyClient:
|
|
|
12674
12899
|
result.Total = pageObj.Total
|
|
12675
12900
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
12676
12901
|
|
|
12677
|
-
#
|
|
12902
|
+
# any results to process?
|
|
12678
12903
|
if (len(result.Items) > 0):
|
|
12904
|
+
|
|
12905
|
+
# sort result items.
|
|
12679
12906
|
if (sortResult is True):
|
|
12680
12907
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
12681
12908
|
|
|
@@ -12841,8 +13068,10 @@ class SpotifyClient:
|
|
|
12841
13068
|
result.Total = pageObj.Total
|
|
12842
13069
|
result.DateLastRefreshed = datetime.utcnow().timestamp()
|
|
12843
13070
|
|
|
12844
|
-
#
|
|
13071
|
+
# any results to process?
|
|
12845
13072
|
if (len(result.Items) > 0):
|
|
13073
|
+
|
|
13074
|
+
# sort result items.
|
|
12846
13075
|
if (sortResult is True):
|
|
12847
13076
|
result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
|
|
12848
13077
|
|