From 9e992af9c15437381974b0dda9c404cd19783da8 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 28 Dec 2021 09:30:52 +0100 Subject: [PATCH] stop creating .cache files wherever the script is run --- deemix/plugins/spotify.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deemix/plugins/spotify.py b/deemix/plugins/spotify.py index 63bfde7..96748b1 100644 --- a/deemix/plugins/spotify.py +++ b/deemix/plugins/spotify.py @@ -13,6 +13,7 @@ from deemix.types.DownloadObjects import Convertable, Collection import spotipy SpotifyClientCredentials = spotipy.oauth2.SpotifyClientCredentials +CacheFileHandler = spotipy.cache_handler.CacheFileHandler class Spotify(Plugin): def __init__(self, configFolder=None): @@ -361,8 +362,10 @@ class Spotify(Plugin): return try: + cache_handler = CacheFileHandler(self.configFolder / ".auth-cache") client_credentials_manager = SpotifyClientCredentials(client_id=self.credentials['clientId'], - client_secret=self.credentials['clientSecret']) + client_secret=self.credentials['clientSecret'], + cache_handler=cache_handler) self.sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager) self.sp.user_playlists('spotify') self.enabled = True