Various refactoring, improvements, fixes

This commit is contained in:
Timothy Rae
2022-02-10 13:16:00 +13:00
parent e2ead013ad
commit f2e5e202c7
4 changed files with 144 additions and 90 deletions

View File

@@ -19,14 +19,17 @@ def open_spotify_session(config):
return spotipy.Spotify(oauth_manager=credentials_manager)
def open_tidal_session():
def open_tidal_session(config = None):
try:
with open('.session.yml', 'r') as session_file:
previous_session = yaml.safe_load(session_file)
except OSError:
previous_session = None
session = tidalapi.Session()
if config:
session = tidalapi.Session(config=config)
else:
session = tidalapi.Session()
if previous_session:
try:
if session.load_oauth_session(previous_session['session_id'],