diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 4d61a5b..b2ffa67 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -5,7 +5,7 @@ author = { "email":"maloja@dev.krateng.ch", "github": "krateng" } -version = 2,12,15 +version = 2,12,16 versionstr = ".".join(str(n) for n in version) links = { "pypi":"malojaserver", diff --git a/maloja/thirdparty/__init__.py b/maloja/thirdparty/__init__.py index 6d1ceb5..3989f39 100644 --- a/maloja/thirdparty/__init__.py +++ b/maloja/thirdparty/__init__.py @@ -36,7 +36,7 @@ def get_image_track_all(track): else: log("Could not get track image for " + str(track) + " from " + service.name) except Exception as e: - log("Error getting track image from " + service.name + ": " + str(e)) + log("Error getting track image from " + service.name + ": " + repr(e)) def get_image_artist_all(artist): for service in services["metadata"]: try: @@ -47,7 +47,7 @@ def get_image_artist_all(artist): else: log("Could not get artist image for " + str(artist) + " from " + service.name) except Exception as e: - log("Error getting artist image from " + service.name + ": " + str(e)) + log("Error getting artist image from " + service.name + ": " + repr(e)) @@ -70,8 +70,7 @@ class GenericInterface: # avoid constant disk access, restart on adding services is acceptable for key in self.settings: self.settings[key] = get_settings(self.settings[key]) - try: self.authorize() - except: pass + self.authorize() def __init_subclass__(cls,abstract=False): if not abstract: diff --git a/maloja/thirdparty/lastfm.py b/maloja/thirdparty/lastfm.py index 7099a6d..d3add7b 100644 --- a/maloja/thirdparty/lastfm.py +++ b/maloja/thirdparty/lastfm.py @@ -21,9 +21,8 @@ class LastFM(MetadataInterface, ProxyScrobbleInterface): metadata = { "trackurl": "https://ws.audioscrobbler.com/2.0/?method=track.getinfo&track={title}&artist={artist}&api_key={apikey}&format=json", "response_type":"json", - "response_parse_tree_track": ["track","album","image",3,"#text"], + "response_parse_tree_track": ["track","album","image",-1,"#text"], "required_settings": ["apikey"], - "activated_setting": "METADATA_LASTFM" } def get_image_artist(self,artist): diff --git a/maloja/thirdparty/musicbrainz.py b/maloja/thirdparty/musicbrainz.py index 4d5373d..61ff755 100644 --- a/maloja/thirdparty/musicbrainz.py +++ b/maloja/thirdparty/musicbrainz.py @@ -20,7 +20,6 @@ class MusicBrainz(MetadataInterface): "response_type":"json", "response_parse_tree_track": ["images",0,"image"], "required_settings": [], - "activated_setting": "METADATA_MUSICBRAINZ" } def get_image_artist(self,artist): diff --git a/maloja/thirdparty/spotify.py b/maloja/thirdparty/spotify.py index fe1a11f..34d83b7 100644 --- a/maloja/thirdparty/spotify.py +++ b/maloja/thirdparty/spotify.py @@ -2,6 +2,7 @@ from . import MetadataInterface, utf, b64 import urllib.parse, urllib.request import json from threading import Timer +from doreah.logging import log class Spotify(MetadataInterface): name = "Spotify" @@ -19,7 +20,6 @@ class Spotify(MetadataInterface): "response_parse_tree_track": ["tracks","items",0,"album","images",0,"url"], "response_parse_tree_artist": ["artists","items",0,"images",0,"url"], "required_settings": ["apiid","secret"], - "activated_setting": "METADATA_SPOTIFY" } def authorize(self): @@ -32,10 +32,18 @@ class Spotify(MetadataInterface): }, "data":bytes(urllib.parse.urlencode({"grant_type":"client_credentials"}),encoding="utf-8") } - req = urllib.request.Request(**keys) - response = urllib.request.urlopen(req) - responsedata = json.loads(response.read()) - expire = responsedata.get("expires_in",3600) - self.settings["token"] = responsedata["access_token"] + try: + req = urllib.request.Request(**keys) + response = urllib.request.urlopen(req) + responsedata = json.loads(response.read()) + if "error" in responsedata: + log("Error authenticating with Spotify: " + responsedata['error_description']) + expire = 3600 + else: + expire = responsedata.get("expires_in",3600) + self.settings["token"] = responsedata["access_token"] + except Exception as e: + log("Error while authenticating with Spotify: " + str(e)) + expire = 3600 Timer(expire,self.authorize).start() return True diff --git a/maloja/web/static/css/maloja.css b/maloja/web/static/css/maloja.css index 2d19cea..7869a97 100644 --- a/maloja/web/static/css/maloja.css +++ b/maloja/web/static/css/maloja.css @@ -614,7 +614,7 @@ table.list td.chart div { height:4px; */ height:20px; - background-color: var(--text-color-tertiary); + background-color: var(--base-color-dark); border-radius: 0px 30px 30px 0px; background-image:url("/media/chartpos_normal.png"); background-position: right;