Use mpd's readpicture as default, fallback to albumart

This commit is contained in:
Allen
2022-11-13 15:36:11 -06:00
parent 7b69a16ced
commit a15f21b5dc

View File

@ -499,14 +499,29 @@ class Player:
A function that fetches the album art and saves
it to self.album_art_loc
"""
readpictureFailed = False
try:
albumart_data = self.client.albumart(song_file)
albumart_data = self.client.readpicture(song_file)
with open(self.album_art_loc, "wb") as f:
f.write(albumart_data["binary"])
except CommandError:
self.drawDefaultAlbumArt()
readpictureFailed = True
# If readpicture fails, try mpd's albumart function
if readpictureFailed:
try:
albumart_data = self.client.albumart(song_file)
with open(self.album_art_loc, "wb") as f:
f.write(albumart_data["binary"])
except CommandError:
# If this also fails, just draw fallback image
self.drawDefaultAlbumArt()
def drawDefaultAlbumArt(self):