1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Add missing save calls in Last.fm handling

This commit is contained in:
Alban Féron 2022-12-31 18:24:29 +01:00
parent b87091dd56
commit 6ab0488620
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165

View File

@ -1,7 +1,7 @@
# This file is part of Supysonic. # This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API. # Supysonic is a Python implementation of the Subsonic server API.
# #
# Copyright (C) 2013-2018 Alban 'spl0k' Féron # Copyright (C) 2013-2022 Alban 'spl0k' Féron
# #
# Distributed under terms of the GNU AGPLv3 license. # Distributed under terms of the GNU AGPLv3 license.
@ -34,11 +34,13 @@ class LastFm:
else: else:
self.__user.lastfm_session = res["session"]["key"] self.__user.lastfm_session = res["session"]["key"]
self.__user.lastfm_status = True self.__user.lastfm_status = True
self.__user.save()
return True, "OK" return True, "OK"
def unlink_account(self): def unlink_account(self):
self.__user.lastfm_session = None self.__user.lastfm_session = None
self.__user.lastfm_status = True self.__user.lastfm_status = True
self.__user.save()
def now_playing(self, track): def now_playing(self, track):
if not self.__enabled: if not self.__enabled:
@ -107,6 +109,7 @@ class LastFm:
if "error" in json: if "error" in json:
if json["error"] in (9, "9"): if json["error"] in (9, "9"):
self.__user.lastfm_status = False self.__user.lastfm_status = False
self.__user.save()
logger.warning("LastFM error %i: %s", json["error"], json["message"]) logger.warning("LastFM error %i: %s", json["error"], json["message"])
return json return json