stop creating .cache files wherever the script is run

This commit is contained in:
RemixDev 2021-12-28 09:30:52 +01:00
parent e77791fe69
commit 9e992af9c1
No known key found for this signature in database
GPG Key ID: B33962B465BDB51C
1 changed files with 4 additions and 1 deletions

View File

@ -13,6 +13,7 @@ from deemix.types.DownloadObjects import Convertable, Collection
import spotipy import spotipy
SpotifyClientCredentials = spotipy.oauth2.SpotifyClientCredentials SpotifyClientCredentials = spotipy.oauth2.SpotifyClientCredentials
CacheFileHandler = spotipy.cache_handler.CacheFileHandler
class Spotify(Plugin): class Spotify(Plugin):
def __init__(self, configFolder=None): def __init__(self, configFolder=None):
@ -361,8 +362,10 @@ class Spotify(Plugin):
return return
try: try:
cache_handler = CacheFileHandler(self.configFolder / ".auth-cache")
client_credentials_manager = SpotifyClientCredentials(client_id=self.credentials['clientId'], 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 = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
self.sp.user_playlists('spotify') self.sp.user_playlists('spotify')
self.enabled = True self.enabled = True