Use mpd's readpicture as default, fallback to albumart
This commit is contained in:
@ -499,6 +499,20 @@ class Player:
|
|||||||
A function that fetches the album art and saves
|
A function that fetches the album art and saves
|
||||||
it to self.album_art_loc
|
it to self.album_art_loc
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
readpictureFailed = False
|
||||||
|
try:
|
||||||
|
albumart_data = self.client.readpicture(song_file)
|
||||||
|
|
||||||
|
with open(self.album_art_loc, "wb") as f:
|
||||||
|
f.write(albumart_data["binary"])
|
||||||
|
|
||||||
|
except CommandError:
|
||||||
|
readpictureFailed = True
|
||||||
|
|
||||||
|
|
||||||
|
# If readpicture fails, try mpd's albumart function
|
||||||
|
if readpictureFailed:
|
||||||
try:
|
try:
|
||||||
albumart_data = self.client.albumart(song_file)
|
albumart_data = self.client.albumart(song_file)
|
||||||
|
|
||||||
@ -506,6 +520,7 @@ class Player:
|
|||||||
f.write(albumart_data["binary"])
|
f.write(albumart_data["binary"])
|
||||||
|
|
||||||
except CommandError:
|
except CommandError:
|
||||||
|
# If this also fails, just draw fallback image
|
||||||
self.drawDefaultAlbumArt()
|
self.drawDefaultAlbumArt()
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user