Fix GH-271

This commit is contained in:
krateng 2023-11-03 13:41:30 +01:00
parent 5495d6e38d
commit 6bb81ce589
2 changed files with 23 additions and 18 deletions

View File

@ -21,6 +21,7 @@ minor_release_name: "Nicole"
- "[Technical] Bumped Python and SQLAlchemy versions" - "[Technical] Bumped Python and SQLAlchemy versions"
- "[Distribution] Removed build of arm/v7 image" - "[Distribution] Removed build of arm/v7 image"
3.2.1: 3.2.1:
commit: "5495d6e38d95c0c2128e1de9a9553b55b6be945b"
notes: notes:
- "[Feature] Added setting for custom week offset" - "[Feature] Added setting for custom week offset"
- "[Feature] Added Musicbrainz album art fetching" - "[Feature] Added Musicbrainz album art fetching"
@ -29,4 +30,7 @@ minor_release_name: "Nicole"
- "[Bugfix] Fixed Spotify import of multiple files" - "[Bugfix] Fixed Spotify import of multiple files"
- "[Bugfix] Fixed process control on FreeBSD" - "[Bugfix] Fixed process control on FreeBSD"
- "[Bugfix] Fixed Spotify authentication thread blocking the process from terminating" - "[Bugfix] Fixed Spotify authentication thread blocking the process from terminating"
- "[Technical] Upgraded all third party modules to use requests module and send User Agent" - "[Technical] Upgraded all third party modules to use requests module and send User Agent"
3.2.2:
notes:
- "[Bugfix] Fixed Last.fm authentication"

View File

@ -55,24 +55,25 @@ class LastFM(MetadataInterface, ProxyScrobbleInterface):
}) })
def authorize(self): def authorize(self):
try: if all(self.settings[key] not in [None,"ASK",False] for key in ["username","password","apikey","secret"]):
response = requests.post( try:
url=self.proxyscrobble['scrobbleurl'], response = requests.post(
params=self.query_compose({ url=self.proxyscrobble['scrobbleurl'],
"method":"auth.getMobileSession", params=self.query_compose({
"username":self.settings["username"], "method":"auth.getMobileSession",
"password":self.settings["password"], "username":self.settings["username"],
"api_key":self.settings["apikey"] "password":self.settings["password"],
}), "api_key":self.settings["apikey"]
headers={ }),
"User-Agent":self.useragent headers={
} "User-Agent":self.useragent
) }
)
data = ElementTree.fromstring(response.text) data = ElementTree.fromstring(response.text)
self.settings["sk"] = data.find("session").findtext("key") self.settings["sk"] = data.find("session").findtext("key")
except Exception as e: except Exception as e:
log("Error while authenticating with LastFM: " + repr(e)) log("Error while authenticating with LastFM: " + repr(e))
# creates signature and returns full query # creates signature and returns full query