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"
- "[Distribution] Removed build of arm/v7 image"
3.2.1:
commit: "5495d6e38d95c0c2128e1de9a9553b55b6be945b"
notes:
- "[Feature] Added setting for custom week offset"
- "[Feature] Added Musicbrainz album art fetching"
@ -29,4 +30,7 @@ minor_release_name: "Nicole"
- "[Bugfix] Fixed Spotify import of multiple files"
- "[Bugfix] Fixed process control on FreeBSD"
- "[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):
try:
response = requests.post(
url=self.proxyscrobble['scrobbleurl'],
params=self.query_compose({
"method":"auth.getMobileSession",
"username":self.settings["username"],
"password":self.settings["password"],
"api_key":self.settings["apikey"]
}),
headers={
"User-Agent":self.useragent
}
)
if all(self.settings[key] not in [None,"ASK",False] for key in ["username","password","apikey","secret"]):
try:
response = requests.post(
url=self.proxyscrobble['scrobbleurl'],
params=self.query_compose({
"method":"auth.getMobileSession",
"username":self.settings["username"],
"password":self.settings["password"],
"api_key":self.settings["apikey"]
}),
headers={
"User-Agent":self.useragent
}
)
data = ElementTree.fromstring(response.text)
self.settings["sk"] = data.find("session").findtext("key")
except Exception as e:
log("Error while authenticating with LastFM: " + repr(e))
data = ElementTree.fromstring(response.text)
self.settings["sk"] = data.find("session").findtext("key")
except Exception as e:
log("Error while authenticating with LastFM: " + repr(e))
# creates signature and returns full query