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

Files changed (23) hide show
  1. {spotifywebapiPython-1.0.76.dist-info → spotifywebapiPython-1.0.78.dist-info}/METADATA +1 -1
  2. {spotifywebapiPython-1.0.76.dist-info → spotifywebapiPython-1.0.78.dist-info}/RECORD +23 -23
  3. spotifywebapipython/const.py +1 -1
  4. spotifywebapipython/docs/__init__.html +19 -2
  5. spotifywebapipython/docs/index.html +2 -2
  6. spotifywebapipython/docs/search.js +1 -1
  7. spotifywebapipython/docs/spotifywebapiPython/const.html +3 -3
  8. spotifywebapipython/docs/spotifywebapiPython/saappmessages.html +2 -2
  9. spotifywebapipython/docs/spotifywebapiPython/sautils.html +2 -2
  10. spotifywebapipython/docs/spotifywebapiPython/spotifyapierror.html +2 -2
  11. spotifywebapipython/docs/spotifywebapiPython/spotifyapimessage.html +2 -2
  12. spotifywebapipython/docs/spotifywebapiPython/spotifyauthtoken.html +2 -2
  13. spotifywebapipython/docs/spotifywebapiPython/spotifyclient.html +116 -59
  14. spotifywebapipython/docs/spotifywebapiPython/spotifydiscovery.html +2 -2
  15. spotifywebapipython/docs/spotifywebapiPython/spotifywebapiauthenticationerror.html +2 -2
  16. spotifywebapipython/docs/spotifywebapiPython/spotifywebapierror.html +2 -2
  17. spotifywebapipython/oauthcli/authclient.py +10 -11
  18. spotifywebapipython/spotifyclient.py +290 -154
  19. spotifywebapipython/zeroconfapi/blobbuilder.py +7 -12
  20. spotifywebapipython/zeroconfapi/zeroconfconnect.py +259 -44
  21. {spotifywebapiPython-1.0.76.dist-info → spotifywebapiPython-1.0.78.dist-info}/LICENSE +0 -0
  22. {spotifywebapiPython-1.0.76.dist-info → spotifywebapiPython-1.0.78.dist-info}/WHEEL +0 -0
  23. {spotifywebapiPython-1.0.76.dist-info → spotifywebapiPython-1.0.78.dist-info}/top_level.txt +0 -0
@@ -2478,12 +2478,14 @@ class SpotifyClient:
2478
2478
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
2479
2479
 
2480
2480
 
2481
- def GetAlbumFavorites(self,
2482
- limit:int=20,
2483
- offset:int=0,
2484
- market:str=None,
2485
- limitTotal:int=None
2486
- ) -> AlbumPageSaved:
2481
+ def GetAlbumFavorites(
2482
+ self,
2483
+ limit:int=20,
2484
+ offset:int=0,
2485
+ market:str=None,
2486
+ limitTotal:int=None,
2487
+ sortResult:bool=True,
2488
+ ) -> AlbumPageSaved:
2487
2489
  """
2488
2490
  Get a list of the albums saved in the current Spotify user's 'Your Library'.
2489
2491
 
@@ -2491,7 +2493,7 @@ class SpotifyClient:
2491
2493
 
2492
2494
  Args:
2493
2495
  limit (int):
2494
- The maximum number of items to return in a page of items.
2496
+ The maximum number of items to return in a page of items when manual paging is used.
2495
2497
  Default: 20, Range: 1 to 50.
2496
2498
  offset (int):
2497
2499
  The page index offset of the first item to return.
@@ -2511,6 +2513,10 @@ class SpotifyClient:
2511
2513
  and paging is automatically used to retrieve all available items up to the
2512
2514
  maximum number specified.
2513
2515
  Default: None (disabled)
2516
+ sortResult (bool):
2517
+ True to sort the items by name; otherwise, False to leave the items in the same order they
2518
+ were returned in by the Spotify Web API.
2519
+ Default: True
2514
2520
 
2515
2521
  Returns:
2516
2522
  An `AlbumPageSaved` object that contains saved album information.
@@ -2547,6 +2553,7 @@ class SpotifyClient:
2547
2553
  apiMethodParms.AppendKeyValue("offset", offset)
2548
2554
  apiMethodParms.AppendKeyValue("market", market)
2549
2555
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
2556
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
2550
2557
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the user's album favorites", apiMethodParms)
2551
2558
 
2552
2559
  # validations.
@@ -2616,7 +2623,7 @@ class SpotifyClient:
2616
2623
  result.Total = pageObj.Total
2617
2624
 
2618
2625
  # sort items on Name property, ascending order.
2619
- if len(result.Items) > 0:
2626
+ if (len(result.Items) > 0) and (sortResult is True):
2620
2627
  result.Items.sort(key=lambda x: (x.Album.Name or "").lower(), reverse=False)
2621
2628
 
2622
2629
  # trace.
@@ -2636,19 +2643,21 @@ class SpotifyClient:
2636
2643
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
2637
2644
 
2638
2645
 
2639
- def GetAlbumNewReleases(self,
2640
- limit:int=20,
2641
- offset:int=0,
2642
- country:str=None,
2643
- limitTotal:int=None
2644
- ) -> AlbumPageSimplified:
2646
+ def GetAlbumNewReleases(
2647
+ self,
2648
+ limit:int=20,
2649
+ offset:int=0,
2650
+ country:str=None,
2651
+ limitTotal:int=None,
2652
+ sortResult:bool=True,
2653
+ ) -> AlbumPageSimplified:
2645
2654
  """
2646
2655
  Get a list of new album releases featured in Spotify (shown, for example, on a
2647
2656
  Spotify player's "Browse" tab).
2648
2657
 
2649
2658
  Args:
2650
2659
  limit (int):
2651
- The maximum number of items to return in a page of items.
2660
+ The maximum number of items to return in a page of items when manual paging is used.
2652
2661
  Default: 20, Range: 1 to 50.
2653
2662
  offset (int):
2654
2663
  The page index offset of the first item to return.
@@ -2665,6 +2674,10 @@ class SpotifyClient:
2665
2674
  and paging is automatically used to retrieve all available items up to the
2666
2675
  maximum number specified.
2667
2676
  Default: None (disabled)
2677
+ sortResult (bool):
2678
+ True to sort the items by name; otherwise, False to leave the items in the same order they
2679
+ were returned in by the Spotify Web API.
2680
+ Default: True
2668
2681
 
2669
2682
  Returns:
2670
2683
  An `AlbumPageSimplified` object that contains simplified album information.
@@ -2701,6 +2714,7 @@ class SpotifyClient:
2701
2714
  apiMethodParms.AppendKeyValue("offset", offset)
2702
2715
  apiMethodParms.AppendKeyValue("country", country)
2703
2716
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
2717
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
2704
2718
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of new album releases", apiMethodParms)
2705
2719
 
2706
2720
  # validations.
@@ -2769,7 +2783,7 @@ class SpotifyClient:
2769
2783
  result.Total = pageObj.Total
2770
2784
 
2771
2785
  # sort items on Name property, ascending order.
2772
- if len(result.Items) > 0:
2786
+ if (len(result.Items) > 0) and (sortResult is True):
2773
2787
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
2774
2788
 
2775
2789
  # trace.
@@ -2896,7 +2910,7 @@ class SpotifyClient:
2896
2910
  The Spotify ID of the album.
2897
2911
  Example: `6vc9OTcyd3hyzabCmsdnwE`
2898
2912
  limit (int):
2899
- The maximum number of items to return in a page of items.
2913
+ The maximum number of items to return in a page of items when manual paging is used.
2900
2914
  Default: 20, Range: 1 to 50.
2901
2915
  offset (int):
2902
2916
  The index of the first item to return; use with limit to get the next set of items.
@@ -3103,14 +3117,16 @@ class SpotifyClient:
3103
3117
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
3104
3118
 
3105
3119
 
3106
- def GetArtistAlbums(self,
3107
- artistId:str,
3108
- include_groups:str='album',
3109
- limit:int=20,
3110
- offset:int=0,
3111
- market:str=None,
3112
- limitTotal:int=None
3113
- ) -> AlbumPageSimplified:
3120
+ def GetArtistAlbums(
3121
+ self,
3122
+ artistId:str,
3123
+ include_groups:str='album',
3124
+ limit:int=20,
3125
+ offset:int=0,
3126
+ market:str=None,
3127
+ limitTotal:int=None,
3128
+ sortResult:bool=True,
3129
+ ) -> AlbumPageSimplified:
3114
3130
  """
3115
3131
  Get Spotify catalog information about an artist's albums.
3116
3132
 
@@ -3124,7 +3140,7 @@ class SpotifyClient:
3124
3140
  Valid values are: `album`, `single`, `appears_on`, `compilation`
3125
3141
  Example: `single,appears_on`
3126
3142
  limit (int):
3127
- The maximum number of items to return in a page of items.
3143
+ The maximum number of items to return in a page of items when manual paging is used.
3128
3144
  Default: 20, Range: 1 to 50.
3129
3145
  offset (int):
3130
3146
  The index of the first item to return; use with limit to get the next set of items.
@@ -3143,6 +3159,10 @@ class SpotifyClient:
3143
3159
  and paging is automatically used to retrieve all available items up to the
3144
3160
  maximum number specified.
3145
3161
  Default: None (disabled)
3162
+ sortResult (bool):
3163
+ True to sort the items by name; otherwise, False to leave the items in the same order they
3164
+ were returned in by the Spotify Web API.
3165
+ Default: True
3146
3166
 
3147
3167
  Returns:
3148
3168
  An `AlbumPageSimplified` object of matching results.
@@ -3181,6 +3201,7 @@ class SpotifyClient:
3181
3201
  apiMethodParms.AppendKeyValue("offset", offset)
3182
3202
  apiMethodParms.AppendKeyValue("market", market)
3183
3203
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
3204
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
3184
3205
  _logsi.LogMethodParmList(SILevel.Verbose, "Get Spotify catalog information about an artist's albums", apiMethodParms)
3185
3206
 
3186
3207
  # validations.
@@ -3251,7 +3272,7 @@ class SpotifyClient:
3251
3272
  result.Total = pageObj.Total
3252
3273
 
3253
3274
  # sort items on Name property, ascending order.
3254
- if len(result.Items) > 0:
3275
+ if (len(result.Items) > 0) and (sortResult is True):
3255
3276
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
3256
3277
 
3257
3278
  # trace.
@@ -3662,11 +3683,13 @@ class SpotifyClient:
3662
3683
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
3663
3684
 
3664
3685
 
3665
- def GetArtistsFollowed(self,
3666
- after:str=None,
3667
- limit:int=20,
3668
- limitTotal:int=None
3669
- ) -> ArtistPage:
3686
+ def GetArtistsFollowed(
3687
+ self,
3688
+ after:str=None,
3689
+ limit:int=20,
3690
+ limitTotal:int=None,
3691
+ sortResult:bool=True,
3692
+ ) -> ArtistPage:
3670
3693
  """
3671
3694
  Get the current user's followed artists.
3672
3695
 
@@ -3676,7 +3699,7 @@ class SpotifyClient:
3676
3699
  the first request.
3677
3700
  Example: `6APm8EjxOHSYM5B4i3vT3q`
3678
3701
  limit (int):
3679
- The maximum number of items to return in a page of items.
3702
+ The maximum number of items to return in a page of items when manual paging is used.
3680
3703
  Default: 20, Range: 1 to 50.
3681
3704
  limitTotal (int):
3682
3705
  The maximum number of items to return for the request.
@@ -3684,6 +3707,10 @@ class SpotifyClient:
3684
3707
  and paging is automatically used to retrieve all available items up to the
3685
3708
  maximum number specified.
3686
3709
  Default: None (disabled)
3710
+ sortResult (bool):
3711
+ True to sort the items by name; otherwise, False to leave the items in the same order they
3712
+ were returned in by the Spotify Web API.
3713
+ Default: True
3687
3714
 
3688
3715
  Returns:
3689
3716
  An `ArtistPage` object of matching results.
@@ -3719,6 +3746,7 @@ class SpotifyClient:
3719
3746
  apiMethodParms.AppendKeyValue("after", after)
3720
3747
  apiMethodParms.AppendKeyValue("limit", limit)
3721
3748
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
3749
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
3722
3750
  _logsi.LogMethodParmList(SILevel.Verbose, "Get the current user's followed artists", apiMethodParms)
3723
3751
 
3724
3752
  # validations.
@@ -3792,7 +3820,7 @@ class SpotifyClient:
3792
3820
  result.CursorAfter = pageObj.CursorAfter
3793
3821
 
3794
3822
  # sort items on Name property, ascending order.
3795
- if len(result.Items) > 0:
3823
+ if (len(result.Items) > 0) and (sortResult is True):
3796
3824
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
3797
3825
 
3798
3826
  # trace.
@@ -4005,7 +4033,7 @@ class SpotifyClient:
4005
4033
  The Spotify ID for the audiobook.
4006
4034
  Example: `74aydHJKgYz3AIq3jjBSv1`
4007
4035
  limit (int):
4008
- The maximum number of items to return in a page of items.
4036
+ The maximum number of items to return in a page of items when manual paging is used.
4009
4037
  Default: 20, Range: 1 to 50.
4010
4038
  offset (int):
4011
4039
  The index of the first item to return; use with limit to get the next set of items.
@@ -4148,11 +4176,13 @@ class SpotifyClient:
4148
4176
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
4149
4177
 
4150
4178
 
4151
- def GetAudiobookFavorites(self,
4152
- limit:int=20,
4153
- offset:int=0,
4154
- limitTotal:int=None
4155
- ) -> AudiobookPageSimplified:
4179
+ def GetAudiobookFavorites(
4180
+ self,
4181
+ limit:int=20,
4182
+ offset:int=0,
4183
+ limitTotal:int=None,
4184
+ sortResult:bool=True,
4185
+ ) -> AudiobookPageSimplified:
4156
4186
  """
4157
4187
  Get a list of the audiobooks saved in the current Spotify user's 'Your Library'.
4158
4188
 
@@ -4160,7 +4190,7 @@ class SpotifyClient:
4160
4190
 
4161
4191
  Args:
4162
4192
  limit (int):
4163
- The maximum number of items to return in a page of items.
4193
+ The maximum number of items to return in a page of items when manual paging is used.
4164
4194
  Default: 20, Range: 1 to 50.
4165
4195
  offset (int):
4166
4196
  The page index offset of the first item to return.
@@ -4172,6 +4202,10 @@ class SpotifyClient:
4172
4202
  and paging is automatically used to retrieve all available items up to the
4173
4203
  maximum number specified.
4174
4204
  Default: None (disabled)
4205
+ sortResult (bool):
4206
+ True to sort the items by name; otherwise, False to leave the items in the same order they
4207
+ were returned in by the Spotify Web API.
4208
+ Default: True
4175
4209
 
4176
4210
  Returns:
4177
4211
  An `AudiobookPageSimplified` object that contains saved audiobook information.
@@ -4207,6 +4241,7 @@ class SpotifyClient:
4207
4241
  apiMethodParms.AppendKeyValue("limit", limit)
4208
4242
  apiMethodParms.AppendKeyValue("offset", offset)
4209
4243
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
4244
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
4210
4245
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users audiobook favorites", apiMethodParms)
4211
4246
 
4212
4247
  # validations.
@@ -4271,7 +4306,7 @@ class SpotifyClient:
4271
4306
  result.Total = pageObj.Total
4272
4307
 
4273
4308
  # sort items on Name property, ascending order.
4274
- if len(result.Items) > 0:
4309
+ if (len(result.Items) > 0) and (sortResult is True):
4275
4310
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
4276
4311
 
4277
4312
  # trace.
@@ -4504,19 +4539,21 @@ class SpotifyClient:
4504
4539
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
4505
4540
 
4506
4541
 
4507
- def GetBrowseCategorys(self,
4508
- limit:int=20,
4509
- offset:int=0,
4510
- country:str=None,
4511
- locale:str=None,
4512
- limitTotal:int=None
4513
- ) -> CategoryPage:
4542
+ def GetBrowseCategorys(
4543
+ self,
4544
+ limit:int=20,
4545
+ offset:int=0,
4546
+ country:str=None,
4547
+ locale:str=None,
4548
+ limitTotal:int=None,
4549
+ sortResult:bool=True,
4550
+ ) -> CategoryPage:
4514
4551
  """
4515
4552
  Get a page of categories used to tag items in Spotify.
4516
4553
 
4517
4554
  Args:
4518
4555
  limit (int):
4519
- The maximum number of items to return in a page of items.
4556
+ The maximum number of items to return in a page of items when manual paging is used.
4520
4557
  Default: 20, Range: 1 to 50.
4521
4558
  offset (int):
4522
4559
  The page index offset of the first item to return.
@@ -4543,6 +4580,10 @@ class SpotifyClient:
4543
4580
  and paging is automatically used to retrieve all available items up to the
4544
4581
  maximum number specified.
4545
4582
  Default: None (disabled)
4583
+ sortResult (bool):
4584
+ True to sort the items by name; otherwise, False to leave the items in the same order they
4585
+ were returned in by the Spotify Web API.
4586
+ Default: True
4546
4587
 
4547
4588
  Returns:
4548
4589
  A `CategoryPage` object that contains a page of category details.
@@ -4580,6 +4621,7 @@ class SpotifyClient:
4580
4621
  apiMethodParms.AppendKeyValue("country", country)
4581
4622
  apiMethodParms.AppendKeyValue("locale", locale)
4582
4623
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
4624
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
4583
4625
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a page of categories used to tag items in Spotify", apiMethodParms)
4584
4626
 
4585
4627
  # validations.
@@ -4650,7 +4692,7 @@ class SpotifyClient:
4650
4692
  result.Total = pageObj.Total
4651
4693
 
4652
4694
  # sort items on Name property, ascending order.
4653
- if len(result.Items) > 0:
4695
+ if (len(result.Items) > 0) and (sortResult is True):
4654
4696
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
4655
4697
 
4656
4698
  # trace.
@@ -4769,13 +4811,15 @@ class SpotifyClient:
4769
4811
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
4770
4812
 
4771
4813
 
4772
- def GetCategoryPlaylists(self,
4773
- categoryId:str,
4774
- limit:int=20,
4775
- offset:int=0,
4776
- country:str=None,
4777
- limitTotal:int=None
4778
- ) -> Tuple[PlaylistPageSimplified, str]:
4814
+ def GetCategoryPlaylists(
4815
+ self,
4816
+ categoryId:str,
4817
+ limit:int=20,
4818
+ offset:int=0,
4819
+ country:str=None,
4820
+ limitTotal:int=None,
4821
+ sortResult:bool=True,
4822
+ ) -> Tuple[PlaylistPageSimplified, str]:
4779
4823
  """
4780
4824
  Get a list of Spotify playlists tagged with a particular category.
4781
4825
 
@@ -4784,7 +4828,7 @@ class SpotifyClient:
4784
4828
  The Spotify category ID for the category.
4785
4829
  Example: `dinner`
4786
4830
  limit (int):
4787
- The maximum number of items to return in a page of items.
4831
+ The maximum number of items to return in a page of items when manual paging is used.
4788
4832
  Default: 20, Range: 1 to 50.
4789
4833
  offset (int):
4790
4834
  The page index offset of the first item to return.
@@ -4801,6 +4845,10 @@ class SpotifyClient:
4801
4845
  and paging is automatically used to retrieve all available items up to the
4802
4846
  maximum number specified.
4803
4847
  Default: None (disabled)
4848
+ sortResult (bool):
4849
+ True to sort the items by name; otherwise, False to leave the items in the same order they
4850
+ were returned in by the Spotify Web API.
4851
+ Default: True
4804
4852
 
4805
4853
  Returns:
4806
4854
  A tuple of 2 objects:
@@ -4850,6 +4898,7 @@ class SpotifyClient:
4850
4898
  apiMethodParms.AppendKeyValue("offset", offset)
4851
4899
  apiMethodParms.AppendKeyValue("country", country)
4852
4900
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
4901
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
4853
4902
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of Spotify playlists tagged with a particular category", apiMethodParms)
4854
4903
 
4855
4904
  # validations.
@@ -4922,7 +4971,7 @@ class SpotifyClient:
4922
4971
  result.Total = pageObj.Total
4923
4972
 
4924
4973
  # sort items on Name property, ascending order.
4925
- if len(result.Items) > 0:
4974
+ if (len(result.Items) > 0) and (sortResult is True):
4926
4975
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
4927
4976
 
4928
4977
  # trace.
@@ -5217,11 +5266,13 @@ class SpotifyClient:
5217
5266
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
5218
5267
 
5219
5268
 
5220
- def GetEpisodeFavorites(self,
5221
- limit:int=20,
5222
- offset:int=0,
5223
- limitTotal:int=None
5224
- ) -> EpisodePageSaved:
5269
+ def GetEpisodeFavorites(
5270
+ self,
5271
+ limit:int=20,
5272
+ offset:int=0,
5273
+ limitTotal:int=None,
5274
+ sortResult:bool=True,
5275
+ ) -> EpisodePageSaved:
5225
5276
  """
5226
5277
  Get a list of the episodes saved in the current Spotify user's 'Your Library'.
5227
5278
 
@@ -5229,7 +5280,7 @@ class SpotifyClient:
5229
5280
 
5230
5281
  Args:
5231
5282
  limit (int):
5232
- The maximum number of items to return in a page of items.
5283
+ The maximum number of items to return in a page of items when manual paging is used.
5233
5284
  Default: 20, Range: 1 to 50.
5234
5285
  offset (int):
5235
5286
  The page index offset of the first item to return.
@@ -5241,6 +5292,10 @@ class SpotifyClient:
5241
5292
  and paging is automatically used to retrieve all available items up to the
5242
5293
  maximum number specified.
5243
5294
  Default: None (disabled)
5295
+ sortResult (bool):
5296
+ True to sort the items by name; otherwise, False to leave the items in the same order they
5297
+ were returned in by the Spotify Web API.
5298
+ Default: True
5244
5299
 
5245
5300
  Returns:
5246
5301
  An `EpisodePageSaved` object that contains saved episode information.
@@ -5276,6 +5331,7 @@ class SpotifyClient:
5276
5331
  apiMethodParms.AppendKeyValue("limit", limit)
5277
5332
  apiMethodParms.AppendKeyValue("offset", offset)
5278
5333
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
5334
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
5279
5335
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users episode favorites", apiMethodParms)
5280
5336
 
5281
5337
  # validations.
@@ -5340,7 +5396,7 @@ class SpotifyClient:
5340
5396
  result.Total = pageObj.Total
5341
5397
 
5342
5398
  # sort items on Name property, ascending order.
5343
- if len(result.Items) > 0:
5399
+ if (len(result.Items) > 0) and (sortResult is True):
5344
5400
  result.Items.sort(key=lambda x: (x.Episode.Name or "").lower(), reverse=False)
5345
5401
 
5346
5402
  # trace.
@@ -5455,20 +5511,22 @@ class SpotifyClient:
5455
5511
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
5456
5512
 
5457
5513
 
5458
- def GetFeaturedPlaylists(self,
5459
- limit:int=20,
5460
- offset:int=0,
5461
- country:str=None,
5462
- locale:str=None,
5463
- timestamp:str=None,
5464
- limitTotal:int=None
5465
- ) -> Tuple[PlaylistPageSimplified, str]:
5514
+ def GetFeaturedPlaylists(
5515
+ self,
5516
+ limit:int=20,
5517
+ offset:int=0,
5518
+ country:str=None,
5519
+ locale:str=None,
5520
+ timestamp:str=None,
5521
+ limitTotal:int=None,
5522
+ sortResult:bool=True,
5523
+ ) -> Tuple[PlaylistPageSimplified, str]:
5466
5524
  """
5467
5525
  Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).
5468
5526
 
5469
5527
  Args:
5470
5528
  limit (int):
5471
- The maximum number of items to return in a page of items.
5529
+ The maximum number of items to return in a page of items when manual paging is used.
5472
5530
  Default: 20, Range: 1 to 50.
5473
5531
  offset (int):
5474
5532
  The page index offset of the first item to return.
@@ -5503,6 +5561,10 @@ class SpotifyClient:
5503
5561
  and paging is automatically used to retrieve all available items up to the
5504
5562
  maximum number specified.
5505
5563
  Default: None (disabled)
5564
+ sortResult (bool):
5565
+ True to sort the items by name; otherwise, False to leave the items in the same order they
5566
+ were returned in by the Spotify Web API.
5567
+ Default: True
5506
5568
 
5507
5569
  Returns:
5508
5570
  A tuple of 2 objects:
@@ -5544,6 +5606,7 @@ class SpotifyClient:
5544
5606
  apiMethodParms.AppendKeyValue("locale", locale)
5545
5607
  apiMethodParms.AppendKeyValue("timestamp", timestamp)
5546
5608
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
5609
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
5547
5610
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of Spotify featured playlists", apiMethodParms)
5548
5611
 
5549
5612
  # validations.
@@ -5617,7 +5680,7 @@ class SpotifyClient:
5617
5680
  result.Total = pageObj.Total
5618
5681
 
5619
5682
  # sort items on Name property, ascending order.
5620
- if len(result.Items) > 0:
5683
+ if (len(result.Items) > 0) and (sortResult is True):
5621
5684
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
5622
5685
 
5623
5686
  # trace.
@@ -6059,7 +6122,8 @@ class SpotifyClient:
6059
6122
  zconn:ZeroconfConnect = ZeroconfConnect(discoverResult.HostIpAddress,
6060
6123
  discoverResult.HostIpPort,
6061
6124
  discoverResult.SpotifyConnectCPath,
6062
- useSSL=False)
6125
+ useSSL=False,
6126
+ tokenStorageDir=self.TokenStorageDir)
6063
6127
 
6064
6128
  # if a different user context has control of the device then we need to disconnect
6065
6129
  # the current user context before connecting a different user.
@@ -6206,9 +6270,11 @@ class SpotifyClient:
6206
6270
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
6207
6271
 
6208
6272
 
6209
- def GetPlayerDevices(self,
6210
- refresh:bool=True
6211
- ) -> list[Device]:
6273
+ def GetPlayerDevices(
6274
+ self,
6275
+ refresh:bool=True,
6276
+ sortResult:bool=True,
6277
+ ) -> list[Device]:
6212
6278
  """
6213
6279
  Get information about a user's available Spotify Connect player devices.
6214
6280
 
@@ -6220,6 +6286,10 @@ class SpotifyClient:
6220
6286
  refresh (bool):
6221
6287
  True (default) to return real-time information from the spotify web api and
6222
6288
  update the cache; otherwise, False to just return the cached value.
6289
+ sortResult (bool):
6290
+ True to sort the items by name; otherwise, False to leave the items in the same order they
6291
+ were returned in by the Spotify Web API.
6292
+ Default: True
6223
6293
 
6224
6294
  Returns:
6225
6295
  A list of `Device` objects that contain the device details, sorted by name.
@@ -6248,15 +6318,18 @@ class SpotifyClient:
6248
6318
  </details>
6249
6319
  """
6250
6320
  apiMethodName:str = 'GetPlayerDevices'
6321
+ apiMethodParms:SIMethodParmListContext = None
6251
6322
  result:list[Device] = []
6252
6323
  cacheDesc:str = CACHE_SOURCE_CURRENT
6253
6324
 
6254
6325
  try:
6255
6326
 
6256
6327
  # trace.
6257
- _logsi.EnterMethod(SILevel.Debug, apiMethodName)
6258
- _logsi.LogVerbose("Get user's available Spotify Connect player devices")
6259
-
6328
+ apiMethodParms = _logsi.EnterMethodParmList(SILevel.Debug, apiMethodName)
6329
+ apiMethodParms.AppendKeyValue("refresh", refresh)
6330
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
6331
+ _logsi.LogMethodParmList(SILevel.Verbose, "Get user's available Spotify Connect player devices", apiMethodParms)
6332
+
6260
6333
  # can we use the cached value?
6261
6334
  if (not refresh) and (apiMethodName in self._ConfigurationCache):
6262
6335
 
@@ -6277,7 +6350,7 @@ class SpotifyClient:
6277
6350
  result.append(Device(root=item))
6278
6351
 
6279
6352
  # sort items on Name property, ascending order.
6280
- if len(result) > 0:
6353
+ if (len(result) > 0) and (sortResult is True):
6281
6354
  result.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
6282
6355
 
6283
6356
  # update cache.
@@ -6554,8 +6627,8 @@ class SpotifyClient:
6554
6627
 
6555
6628
  Args:
6556
6629
  limit (int):
6557
- The maximum number of items to return in a page of items.
6558
- Default: `20`, Range: `1` to `50`.
6630
+ The maximum number of items to return in a page of items when manual paging is used.
6631
+ Default: 20, Range: 1 to 50.
6559
6632
  after (int):
6560
6633
  Returns all items after (but not including) this cursor position, which is
6561
6634
  a Unix timestamp in milliseconds.
@@ -6942,7 +7015,7 @@ class SpotifyClient:
6942
7015
  The Spotify ID of the playlist.
6943
7016
  Example: `5v5ETK9WFXAnGQ3MRubKuE`
6944
7017
  limit (int):
6945
- The maximum number of items to return in a page of items.
7018
+ The maximum number of items to return in a page of items when manual paging is used.
6946
7019
  Default: 50, Range: 1 to 50.
6947
7020
  offset (int):
6948
7021
  The page index offset of the first item to return.
@@ -7112,11 +7185,13 @@ class SpotifyClient:
7112
7185
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
7113
7186
 
7114
7187
 
7115
- def GetPlaylistFavorites(self,
7116
- limit:int=20,
7117
- offset:int=0,
7118
- limitTotal:int=None
7119
- ) -> PlaylistPageSimplified:
7188
+ def GetPlaylistFavorites(
7189
+ self,
7190
+ limit:int=20,
7191
+ offset:int=0,
7192
+ limitTotal:int=None,
7193
+ sortResult:bool=True,
7194
+ ) -> PlaylistPageSimplified:
7120
7195
  """
7121
7196
  Get a list of the playlists owned or followed by the current Spotify user.
7122
7197
 
@@ -7124,7 +7199,7 @@ class SpotifyClient:
7124
7199
 
7125
7200
  Args:
7126
7201
  limit (int):
7127
- The maximum number of items to return in a page of items.
7202
+ The maximum number of items to return in a page of items when manual paging is used.
7128
7203
  Default: 20, Range: 1 to 50.
7129
7204
  offset (int):
7130
7205
  The page index offset of the first item to return.
@@ -7136,6 +7211,10 @@ class SpotifyClient:
7136
7211
  and paging is automatically used to retrieve all available items up to the
7137
7212
  maximum number specified.
7138
7213
  Default: None (disabled)
7214
+ sortResult (bool):
7215
+ True to sort the items by name; otherwise, False to leave the items in the same order they
7216
+ were returned in by the Spotify Web API.
7217
+ Default: True
7139
7218
 
7140
7219
  Returns:
7141
7220
  An `PlaylistPageSimplified` object that contains playlist information.
@@ -7171,6 +7250,7 @@ class SpotifyClient:
7171
7250
  apiMethodParms.AppendKeyValue("limit", limit)
7172
7251
  apiMethodParms.AppendKeyValue("offset", offset)
7173
7252
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
7253
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
7174
7254
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users playlist favorites", apiMethodParms)
7175
7255
 
7176
7256
  # validations.
@@ -7235,7 +7315,7 @@ class SpotifyClient:
7235
7315
  result.Total = pageObj.Total
7236
7316
 
7237
7317
  # sort items on Name property, ascending order.
7238
- if len(result.Items) > 0:
7318
+ if (len(result.Items) > 0) and (sortResult is True):
7239
7319
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
7240
7320
 
7241
7321
  # trace.
@@ -7255,12 +7335,14 @@ class SpotifyClient:
7255
7335
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
7256
7336
 
7257
7337
 
7258
- def GetPlaylistsForUser(self,
7259
- userId:str,
7260
- limit:int=20,
7261
- offset:int=0,
7262
- limitTotal:int=None
7263
- ) -> PlaylistPageSimplified:
7338
+ def GetPlaylistsForUser(
7339
+ self,
7340
+ userId:str,
7341
+ limit:int=20,
7342
+ offset:int=0,
7343
+ limitTotal:int=None,
7344
+ sortResult:bool=True,
7345
+ ) -> PlaylistPageSimplified:
7264
7346
  """
7265
7347
  Get a list of the playlists owned or followed by a Spotify user.
7266
7348
 
@@ -7271,7 +7353,7 @@ class SpotifyClient:
7271
7353
  The user's Spotify user ID.
7272
7354
  Example: `smedjan`
7273
7355
  limit (int):
7274
- The maximum number of items to return in a page of items.
7356
+ The maximum number of items to return in a page of items when manual paging is used.
7275
7357
  Default: 20, Range: 1 to 50.
7276
7358
  offset (int):
7277
7359
  The page index offset of the first item to return.
@@ -7283,6 +7365,10 @@ class SpotifyClient:
7283
7365
  and paging is automatically used to retrieve all available items up to the
7284
7366
  maximum number specified.
7285
7367
  Default: None (disabled)
7368
+ sortResult (bool):
7369
+ True to sort the items by name; otherwise, False to leave the items in the same order they
7370
+ were returned in by the Spotify Web API.
7371
+ Default: True
7286
7372
 
7287
7373
  Returns:
7288
7374
  An `PlaylistPageSimplified` object that contains playlist information.
@@ -7319,6 +7405,7 @@ class SpotifyClient:
7319
7405
  apiMethodParms.AppendKeyValue("limit", limit)
7320
7406
  apiMethodParms.AppendKeyValue("offset", offset)
7321
7407
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
7408
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
7322
7409
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the playlists owned or followed by a Spotify user", apiMethodParms)
7323
7410
 
7324
7411
  # validations.
@@ -7384,7 +7471,7 @@ class SpotifyClient:
7384
7471
  result.Total = pageObj.Total
7385
7472
 
7386
7473
  # sort items on Name property, ascending order.
7387
- if len(result.Items) > 0:
7474
+ if (len(result.Items) > 0) and (sortResult is True):
7388
7475
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
7389
7476
 
7390
7477
  # trace.
@@ -7509,7 +7596,7 @@ class SpotifyClient:
7509
7596
  The Spotify ID for the show.
7510
7597
  Example: `6kAsbP8pxwaU2kPibKTuHE`
7511
7598
  limit (int):
7512
- The maximum number of items to return in a page of items.
7599
+ The maximum number of items to return in a page of items when manual paging is used.
7513
7600
  Default: 20, Range: 1 to 50.
7514
7601
  offset (int):
7515
7602
  The index of the first item to return; use with limit to get the next set of items.
@@ -7652,11 +7739,13 @@ class SpotifyClient:
7652
7739
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
7653
7740
 
7654
7741
 
7655
- def GetShowFavorites(self,
7656
- limit:int=20,
7657
- offset:int=0,
7658
- limitTotal:int=None
7659
- ) -> ShowPageSaved:
7742
+ def GetShowFavorites(
7743
+ self,
7744
+ limit:int=20,
7745
+ offset:int=0,
7746
+ limitTotal:int=None,
7747
+ sortResult:bool=True,
7748
+ ) -> ShowPageSaved:
7660
7749
  """
7661
7750
  Get a list of the shows saved in the current Spotify user's 'Your Library'.
7662
7751
 
@@ -7664,7 +7753,7 @@ class SpotifyClient:
7664
7753
 
7665
7754
  Args:
7666
7755
  limit (int):
7667
- The maximum number of items to return in a page of items.
7756
+ The maximum number of items to return in a page of items when manual paging is used.
7668
7757
  Default: 20, Range: 1 to 50.
7669
7758
  offset (int):
7670
7759
  The page index offset of the first item to return.
@@ -7676,6 +7765,10 @@ class SpotifyClient:
7676
7765
  and paging is automatically used to retrieve all available items up to the
7677
7766
  maximum number specified.
7678
7767
  Default: None (disabled)
7768
+ sortResult (bool):
7769
+ True to sort the items by name; otherwise, False to leave the items in the same order they
7770
+ were returned in by the Spotify Web API.
7771
+ Default: True
7679
7772
 
7680
7773
  Returns:
7681
7774
  An `ShowPageSaved` object that contains saved show information.
@@ -7711,6 +7804,7 @@ class SpotifyClient:
7711
7804
  apiMethodParms.AppendKeyValue("limit", limit)
7712
7805
  apiMethodParms.AppendKeyValue("offset", offset)
7713
7806
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
7807
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
7714
7808
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users show favorites", apiMethodParms)
7715
7809
 
7716
7810
  # validations.
@@ -7775,7 +7869,7 @@ class SpotifyClient:
7775
7869
  result.Total = pageObj.Total
7776
7870
 
7777
7871
  # sort items on Name property, ascending order.
7778
- if len(result.Items) > 0:
7872
+ if (len(result.Items) > 0) and (sortResult is True):
7779
7873
  result.Items.sort(key=lambda x: (x.Show.Name or "").lower(), reverse=False)
7780
7874
 
7781
7875
  # trace.
@@ -8002,7 +8096,8 @@ class SpotifyClient:
8002
8096
  zconn = ZeroconfConnect(discoverResult.HostIpAddress,
8003
8097
  discoverResult.HostIpPort,
8004
8098
  discoverResult.SpotifyConnectCPath,
8005
- useSSL=False)
8099
+ useSSL=False,
8100
+ tokenStorageDir=self.TokenStorageDir)
8006
8101
  info = zconn.GetInformation()
8007
8102
 
8008
8103
  except Exception as ex:
@@ -8016,7 +8111,8 @@ class SpotifyClient:
8016
8111
  zconn = ZeroconfConnect(discoverResult.Server,
8017
8112
  discoverResult.HostIpPort,
8018
8113
  discoverResult.SpotifyConnectCPath,
8019
- useSSL=False)
8114
+ useSSL=False,
8115
+ tokenStorageDir=self.TokenStorageDir)
8020
8116
  info = zconn.GetInformation()
8021
8117
 
8022
8118
  # update HostIpAddress in discovery result so it knows to use the alias
@@ -8217,12 +8313,14 @@ class SpotifyClient:
8217
8313
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
8218
8314
 
8219
8315
 
8220
- def GetTrackFavorites(self,
8221
- limit:int=20,
8222
- offset:int=0,
8223
- market:str=None,
8224
- limitTotal:int=None
8225
- ) -> TrackPageSaved:
8316
+ def GetTrackFavorites(
8317
+ self,
8318
+ limit:int=20,
8319
+ offset:int=0,
8320
+ market:str=None,
8321
+ limitTotal:int=None,
8322
+ sortResult:bool=True,
8323
+ ) -> TrackPageSaved:
8226
8324
  """
8227
8325
  Get a list of the tracks saved in the current Spotify user's 'Your Library'.
8228
8326
 
@@ -8230,7 +8328,7 @@ class SpotifyClient:
8230
8328
 
8231
8329
  Args:
8232
8330
  limit (int):
8233
- The maximum number of items to return in a page of items.
8331
+ The maximum number of items to return in a page of items when manual paging is used.
8234
8332
  Default: 20, Range: 1 to 50.
8235
8333
  offset (int):
8236
8334
  The page index offset of the first item to return.
@@ -8250,6 +8348,10 @@ class SpotifyClient:
8250
8348
  and paging is automatically used to retrieve all available items up to the
8251
8349
  maximum number specified.
8252
8350
  Default: None (disabled)
8351
+ sortResult (bool):
8352
+ True to sort the items by name; otherwise, False to leave the items in the same order they
8353
+ were returned in by the Spotify Web API.
8354
+ Default: True
8253
8355
 
8254
8356
  Returns:
8255
8357
  An `TrackPageSaved` object that contains saved track information.
@@ -8286,6 +8388,7 @@ class SpotifyClient:
8286
8388
  apiMethodParms.AppendKeyValue("offset", offset)
8287
8389
  apiMethodParms.AppendKeyValue("market", market)
8288
8390
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
8391
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
8289
8392
  _logsi.LogMethodParmList(SILevel.Verbose, "Get a list of the users track favorites", apiMethodParms)
8290
8393
 
8291
8394
  # validations.
@@ -8355,7 +8458,7 @@ class SpotifyClient:
8355
8458
  result.Total = pageObj.Total
8356
8459
 
8357
8460
  # sort items on Name property, ascending order.
8358
- if len(result.Items) > 0:
8461
+ if (len(result.Items) > 0) and (sortResult is True):
8359
8462
  result.Items.sort(key=lambda x: (x.Track.Name or "").lower(), reverse=False)
8360
8463
 
8361
8464
  # trace.
@@ -9130,12 +9233,14 @@ class SpotifyClient:
9130
9233
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
9131
9234
 
9132
9235
 
9133
- def GetUsersTopArtists(self,
9134
- timeRange:str='medium_term',
9135
- limit:int=20,
9136
- offset:int=0,
9137
- limitTotal:int=None
9138
- ) -> ArtistPage:
9236
+ def GetUsersTopArtists(
9237
+ self,
9238
+ timeRange:str='medium_term',
9239
+ limit:int=20,
9240
+ offset:int=0,
9241
+ limitTotal:int=None,
9242
+ sortResult:bool=True,
9243
+ ) -> ArtistPage:
9139
9244
  """
9140
9245
  Get the current user's top artists based on calculated affinity.
9141
9246
 
@@ -9149,7 +9254,7 @@ class SpotifyClient:
9149
9254
  Default: `medium_term`
9150
9255
  Example: `long_term`
9151
9256
  limit (int):
9152
- The maximum number of items to return in a page of items.
9257
+ The maximum number of items to return in a page of items when manual paging is used.
9153
9258
  Default: 20, Range: 1 to 50.
9154
9259
  offset (int):
9155
9260
  The page index offset of the first item to return.
@@ -9161,6 +9266,10 @@ class SpotifyClient:
9161
9266
  and paging is automatically used to retrieve all available items up to the
9162
9267
  maximum number specified.
9163
9268
  Default: None (disabled)
9269
+ sortResult (bool):
9270
+ True to sort the items by name; otherwise, False to leave the items in the same order they
9271
+ were returned in by the Spotify Web API.
9272
+ Default: True
9164
9273
 
9165
9274
  Returns:
9166
9275
  An `ArtistPage` object of matching results.
@@ -9197,6 +9306,7 @@ class SpotifyClient:
9197
9306
  apiMethodParms.AppendKeyValue("limit", limit)
9198
9307
  apiMethodParms.AppendKeyValue("offset", offset)
9199
9308
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
9309
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
9200
9310
  _logsi.LogMethodParmList(SILevel.Verbose, "Get the current user's top artists", apiMethodParms)
9201
9311
 
9202
9312
  # validations.
@@ -9264,7 +9374,7 @@ class SpotifyClient:
9264
9374
  result.Total = pageObj.Total
9265
9375
 
9266
9376
  # sort items on Name property, ascending order.
9267
- if len(result.Items) > 0:
9377
+ if (len(result.Items) > 0) and (sortResult is True):
9268
9378
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
9269
9379
 
9270
9380
  # trace.
@@ -9284,12 +9394,14 @@ class SpotifyClient:
9284
9394
  _logsi.LeaveMethod(SILevel.Debug, apiMethodName)
9285
9395
 
9286
9396
 
9287
- def GetUsersTopTracks(self,
9288
- timeRange:str='medium_term',
9289
- limit:int=20,
9290
- offset:int=0,
9291
- limitTotal:int=None
9292
- ) -> TrackPage:
9397
+ def GetUsersTopTracks(
9398
+ self,
9399
+ timeRange:str='medium_term',
9400
+ limit:int=20,
9401
+ offset:int=0,
9402
+ limitTotal:int=None,
9403
+ sortResult:bool=True,
9404
+ ) -> TrackPage:
9293
9405
  """
9294
9406
  Get the current user's top tracks based on calculated affinity.
9295
9407
 
@@ -9303,7 +9415,7 @@ class SpotifyClient:
9303
9415
  Default: `medium_term`
9304
9416
  Example: `long_term`
9305
9417
  limit (int):
9306
- The maximum number of items to return in a page of items.
9418
+ The maximum number of items to return in a page of items when manual paging is used.
9307
9419
  Default: 20, Range: 1 to 50.
9308
9420
  offset (int):
9309
9421
  The page index offset of the first item to return.
@@ -9315,6 +9427,10 @@ class SpotifyClient:
9315
9427
  and paging is automatically used to retrieve all available items up to the
9316
9428
  maximum number specified.
9317
9429
  Default: None (disabled)
9430
+ sortResult (bool):
9431
+ True to sort the items by name; otherwise, False to leave the items in the same order they
9432
+ were returned in by the Spotify Web API.
9433
+ Default: True
9318
9434
 
9319
9435
  Returns:
9320
9436
  An `TrackPage` object of matching results.
@@ -9351,6 +9467,7 @@ class SpotifyClient:
9351
9467
  apiMethodParms.AppendKeyValue("limit", limit)
9352
9468
  apiMethodParms.AppendKeyValue("offset", offset)
9353
9469
  apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
9470
+ apiMethodParms.AppendKeyValue("sortResult", sortResult)
9354
9471
  _logsi.LogMethodParmList(SILevel.Verbose, "Get the current user's top tracks", apiMethodParms)
9355
9472
 
9356
9473
  # validations.
@@ -9418,7 +9535,7 @@ class SpotifyClient:
9418
9535
  result.Total = pageObj.Total
9419
9536
 
9420
9537
  # sort items on Name property, ascending order.
9421
- if len(result.Items) > 0:
9538
+ if (len(result.Items) > 0) and (sortResult is True):
9422
9539
  result.Items.sort(key=lambda x: (x.Name or "").lower(), reverse=False)
9423
9540
 
9424
9541
  # trace.
@@ -9722,6 +9839,7 @@ class SpotifyClient:
9722
9839
  shuffle:bool=True,
9723
9840
  delay:float=0.50,
9724
9841
  resolveDeviceId:bool=True,
9842
+ limitTotal:int=200,
9725
9843
  ) -> None:
9726
9844
  """
9727
9845
  Get a list of the tracks saved in the current Spotify user's 'Your Library'
@@ -9743,6 +9861,9 @@ class SpotifyClient:
9743
9861
  resolveDeviceId (bool):
9744
9862
  True to resolve the supplied `deviceId` value; otherwise, False not resolve the `deviceId`
9745
9863
  value as it has already been resolved.
9864
+ limitTotal (int):
9865
+ The maximum number of items to retrieve from favorites.
9866
+ Default: 200
9746
9867
 
9747
9868
  Raises:
9748
9869
  SpotifyWebApiError:
@@ -9774,13 +9895,14 @@ class SpotifyClient:
9774
9895
  apiMethodParms.AppendKeyValue("shuffle", shuffle)
9775
9896
  apiMethodParms.AppendKeyValue("delay", delay)
9776
9897
  apiMethodParms.AppendKeyValue("resolveDeviceId", resolveDeviceId)
9898
+ apiMethodParms.AppendKeyValue("limitTotal", limitTotal)
9777
9899
  _logsi.LogMethodParmList(SILevel.Verbose, "Spotify Connect device play track favorites", apiMethodParms)
9778
9900
 
9779
9901
  # validations.
9780
9902
  delay = validateDelay(delay, 0.50, 10)
9781
9903
 
9782
9904
  # get current users favorite tracks.
9783
- tracks:TrackPageSaved = self.GetTrackFavorites(limitTotal=200)
9905
+ tracks:TrackPageSaved = self.GetTrackFavorites(limitTotal=limitTotal)
9784
9906
  if (tracks.ItemsCount == 0):
9785
9907
  _logsi.LogVerbose("Current user has no favorite tracks; nothing to do")
9786
9908
  return
@@ -9799,7 +9921,8 @@ class SpotifyClient:
9799
9921
  deviceId = self.PlayerResolveDeviceId(deviceId, verifyUserContext=True)
9800
9922
 
9801
9923
  # set desired shuffle mode.
9802
- self.PlayerSetShuffleMode(shuffle, deviceId, delay)
9924
+ if shuffle is not None:
9925
+ self.PlayerSetShuffleMode(shuffle, deviceId, delay)
9803
9926
 
9804
9927
  # play the tracks.
9805
9928
  # indicate device id has already been resolved.
@@ -10516,7 +10639,8 @@ class SpotifyClient:
10516
10639
  zconn:ZeroconfConnect = ZeroconfConnect(discoverResult.HostIpAddress,
10517
10640
  discoverResult.HostIpPort,
10518
10641
  discoverResult.SpotifyConnectCPath,
10519
- useSSL=False)
10642
+ useSSL=False,
10643
+ tokenStorageDir=self.TokenStorageDir)
10520
10644
 
10521
10645
  # if a different user context has control of the device then we need to disconnect
10522
10646
  # the current user context before connecting a different user.
@@ -12489,7 +12613,7 @@ class SpotifyClient:
12489
12613
  The tag:new filter will return albums released in the past two weeks and tag:hipster
12490
12614
  can be used to return only albums with the lowest 10% popularity.
12491
12615
  limit (int):
12492
- The maximum number of items to return in a page of items.
12616
+ The maximum number of items to return in a page of items when manual paging is used.
12493
12617
  Default: 20, Range: 1 to 50.
12494
12618
  offset (int):
12495
12619
  The page index offset of the first item to return.
@@ -12679,7 +12803,7 @@ class SpotifyClient:
12679
12803
  The tag:new filter will return albums released in the past two weeks and tag:hipster
12680
12804
  can be used to return only albums with the lowest 10% popularity.
12681
12805
  limit (int):
12682
- The maximum number of items to return in a page of items.
12806
+ The maximum number of items to return in a page of items when manual paging is used.
12683
12807
  Default: 20, Range: 1 to 50.
12684
12808
  offset (int):
12685
12809
  The page index offset of the first item to return.
@@ -12869,7 +12993,7 @@ class SpotifyClient:
12869
12993
  The tag:new filter will return albums released in the past two weeks and tag:hipster
12870
12994
  can be used to return only albums with the lowest 10% popularity.
12871
12995
  limit (int):
12872
- The maximum number of items to return in a page of items.
12996
+ The maximum number of items to return in a page of items when manual paging is used.
12873
12997
  Default: 20, Range: 1 to 50.
12874
12998
  offset (int):
12875
12999
  The page index offset of the first item to return.
@@ -13061,7 +13185,7 @@ class SpotifyClient:
13061
13185
  The tag:new filter will return albums released in the past two weeks and tag:hipster
13062
13186
  can be used to return only albums with the lowest 10% popularity.
13063
13187
  limit (int):
13064
- The maximum number of items to return in a page of items.
13188
+ The maximum number of items to return in a page of items when manual paging is used.
13065
13189
  Default: 20, Range: 1 to 50.
13066
13190
  offset (int):
13067
13191
  The page index offset of the first item to return.
@@ -13251,7 +13375,7 @@ class SpotifyClient:
13251
13375
  The tag:new filter will return albums released in the past two weeks and tag:hipster
13252
13376
  can be used to return only albums with the lowest 10% popularity.
13253
13377
  limit (int):
13254
- The maximum number of items to return in a page of items.
13378
+ The maximum number of items to return in a page of items when manual paging is used.
13255
13379
  Default: 20, Range: 1 to 50.
13256
13380
  offset (int):
13257
13381
  The page index offset of the first item to return.
@@ -13441,7 +13565,7 @@ class SpotifyClient:
13441
13565
  The tag:new filter will return albums released in the past two weeks and tag:hipster
13442
13566
  can be used to return only albums with the lowest 10% popularity.
13443
13567
  limit (int):
13444
- The maximum number of items to return in a page of items.
13568
+ The maximum number of items to return in a page of items when manual paging is used.
13445
13569
  Default: 20, Range: 1 to 50.
13446
13570
  offset (int):
13447
13571
  The page index offset of the first item to return.
@@ -13631,7 +13755,7 @@ class SpotifyClient:
13631
13755
  The tag:new filter will return albums released in the past two weeks and tag:hipster
13632
13756
  can be used to return only albums with the lowest 10% popularity.
13633
13757
  limit (int):
13634
- The maximum number of items to return in a page of items.
13758
+ The maximum number of items to return in a page of items when manual paging is used.
13635
13759
  Default: 20, Range: 1 to 50.
13636
13760
  offset (int):
13637
13761
  The page index offset of the first item to return.
@@ -13802,7 +13926,8 @@ class SpotifyClient:
13802
13926
  tokenProfileId:str=None,
13803
13927
  forceAuthorize:bool=False,
13804
13928
  redirectUriHost:str='localhost',
13805
- redirectUriPort:int=8080
13929
+ redirectUriPort:int=8080,
13930
+ redirectUriPath:str='/',
13806
13931
  ) -> None:
13807
13932
  """
13808
13933
  Generates a new Authorization Code type of authorization token used to access
@@ -13836,6 +13961,10 @@ class SpotifyClient:
13836
13961
  port range is specified, then the logic will loop through the port range looking
13837
13962
  for an available port to use.
13838
13963
  Default is 8080.
13964
+ redirectUriPath (str):
13965
+ Path value to add when constructing the redirect_uri; otherwise,
13966
+ None to not add a path value.
13967
+ Default value is '/'.
13839
13968
 
13840
13969
  Raises:
13841
13970
  SpotifApiError:
@@ -13866,8 +13995,8 @@ class SpotifyClient:
13866
13995
  Note that you must have 'http://localhost:8080/' in the Redirect URI allowlist that you
13867
13996
  specified when you registered your application in the Spotify Developer Portal. The
13868
13997
  redirect URI is case-sensitive, and must contain the trailing slash. You will need to
13869
- adjust the redirect URI value if you specify custom values using the `redirectUriHost`
13870
- and `redirectUriPort` arguments.
13998
+ adjust the redirect URI value if you specify custom values using the `redirectUriHost`,
13999
+ `redirectUriPort`, and `redirectUriPath` arguments.
13871
14000
  """
13872
14001
  apiMethodName:str = 'SetAuthTokenAuthorizationCode'
13873
14002
  apiMethodParms:SIMethodParmListContext = None
@@ -13884,6 +14013,7 @@ class SpotifyClient:
13884
14013
  apiMethodParms.AppendKeyValue("forceAuthorize", forceAuthorize)
13885
14014
  apiMethodParms.AppendKeyValue("redirectUriHost", redirectUriHost)
13886
14015
  apiMethodParms.AppendKeyValue("redirectUriPort", redirectUriPort)
14016
+ apiMethodParms.AppendKeyValue("redirectUriPath", redirectUriPath)
13887
14017
  _logsi.LogMethodParmList(SILevel.Verbose, TRACE_MSG_AUTHTOKEN_CREATE % authorizationType, apiMethodParms)
13888
14018
 
13889
14019
  # validation.
@@ -13923,8 +14053,8 @@ class SpotifyClient:
13923
14053
  self._AuthClient.AuthorizeWithServer(
13924
14054
  host=redirectUriHost,
13925
14055
  port=redirectUriPort,
14056
+ redirect_uri_path=redirectUriPath,
13926
14057
  open_browser=True,
13927
- redirect_uri_trailing_slash=True,
13928
14058
  force=forceAuthorize,
13929
14059
  timeout_seconds=120
13930
14060
  )
@@ -13983,6 +14113,7 @@ class SpotifyClient:
13983
14113
  forceAuthorize:bool=False,
13984
14114
  redirectUriHost:str='localhost',
13985
14115
  redirectUriPort:int=8080,
14116
+ redirectUriPath:str='/'
13986
14117
  ) -> None:
13987
14118
  """
13988
14119
  Generates a new Authorization Code PKCE type of authorization token used to access
@@ -14014,6 +14145,10 @@ class SpotifyClient:
14014
14145
  port range is specified, then the logic will loop through the port range looking
14015
14146
  for an available port to use.
14016
14147
  Default is 8080.
14148
+ redirectUriPath (str):
14149
+ Path value to add when constructing the redirect_uri; otherwise,
14150
+ None to not add a path value.
14151
+ Default value is '/'.
14017
14152
 
14018
14153
  Raises:
14019
14154
  SpotifApiError:
@@ -14043,8 +14178,8 @@ class SpotifyClient:
14043
14178
  Note that you must have 'http://localhost:8080/' in the Redirect URI allowlist that you
14044
14179
  specified when you registered your application in the Spotify Developer Portal. The
14045
14180
  redirect URI is case-sensitive, and must contain the trailing slash. You will need to
14046
- adjust the redirect URI value if you specify custom values using the `redirectUriHost`
14047
- and `redirectUriPort` arguments.
14181
+ adjust the redirect URI value if you specify custom values using the `redirectUriHost`,
14182
+ `redirectUriPort`, and `redirectUriPath` arguments.
14048
14183
  """
14049
14184
  apiMethodName:str = 'SetAuthTokenAuthorizationCodePKCE'
14050
14185
  apiMethodParms:SIMethodParmListContext = None
@@ -14060,6 +14195,7 @@ class SpotifyClient:
14060
14195
  apiMethodParms.AppendKeyValue("forceAuthorize", forceAuthorize)
14061
14196
  apiMethodParms.AppendKeyValue("redirectUriHost", redirectUriHost)
14062
14197
  apiMethodParms.AppendKeyValue("redirectUriPort", redirectUriPort)
14198
+ apiMethodParms.AppendKeyValue("redirectUriPath", redirectUriPath)
14063
14199
  _logsi.LogMethodParmList(SILevel.Verbose, TRACE_MSG_AUTHTOKEN_CREATE % authorizationType, apiMethodParms)
14064
14200
 
14065
14201
  # validation.
@@ -14099,8 +14235,8 @@ class SpotifyClient:
14099
14235
  self._AuthClient.AuthorizeWithServer(
14100
14236
  host=redirectUriHost,
14101
14237
  port=redirectUriPort,
14238
+ redirect_uri_path=redirectUriPath,
14102
14239
  open_browser=True,
14103
- redirect_uri_trailing_slash=True,
14104
14240
  force=forceAuthorize,
14105
14241
  timeout_seconds=120
14106
14242
  )