mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Third party improvements
This commit is contained in:
parent
c2f8ecc2df
commit
23cc1ac341
30
maloja/thirdparty/__init__.py
vendored
30
maloja/thirdparty/__init__.py
vendored
@ -28,20 +28,26 @@ def proxy_scrobble_all(artists,title,timestamp):
|
||||
|
||||
def get_image_track_all(track):
|
||||
for service in services["metadata"]:
|
||||
res = service.get_image_track(track)
|
||||
if res is not None:
|
||||
log("Got track image for " + str(track) + " from " + service.name)
|
||||
return res
|
||||
else:
|
||||
log("Could not get track image for " + str(track) + " from " + service.name)
|
||||
try:
|
||||
res = service.get_image_track(track)
|
||||
if res is not None:
|
||||
log("Got track image for " + str(track) + " from " + service.name)
|
||||
return res
|
||||
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))
|
||||
def get_image_artist_all(artist):
|
||||
for service in services["metadata"]:
|
||||
res = service.get_image_artist(artist)
|
||||
if res is not None:
|
||||
log("Got artist image for " + str(artist) + " from " + service.name)
|
||||
return res
|
||||
else:
|
||||
log("Could not get artist image for " + str(artist) + " from " + service.name)
|
||||
try:
|
||||
res = service.get_image_artist(artist)
|
||||
if res is not None:
|
||||
log("Got artist image for " + str(artist) + " from " + service.name)
|
||||
return res
|
||||
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))
|
||||
|
||||
|
||||
|
||||
|
2
maloja/thirdparty/spotify.py
vendored
2
maloja/thirdparty/spotify.py
vendored
@ -36,7 +36,7 @@ class Spotify(MetadataInterface):
|
||||
req = urllib.request.Request(**keys)
|
||||
response = urllib.request.urlopen(req)
|
||||
responsedata = json.loads(response.read())
|
||||
expire = responsedata["expires_in"]
|
||||
expire = responsedata.get("expires_in",3600)
|
||||
self.settings["token"] = responsedata["access_token"]
|
||||
Timer(expire,self.authorize).start()
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user