From 9558ad0d97cb19dd16919100b7099b795c412863 Mon Sep 17 00:00:00 2001 From: Allen <63997543+aaw3@users.noreply.github.com> Date: Sat, 12 Nov 2022 23:32:11 -0600 Subject: [PATCH] Add readpicture mpd function option to miniplayer --- bin/miniplayer | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/miniplayer b/bin/miniplayer index db52c1e..fa551aa 100755 --- a/bin/miniplayer +++ b/bin/miniplayer @@ -22,11 +22,13 @@ if "player" not in config.sections(): "album_art_only": False, "volume_step": 5, "auto_close": False, - "show_playlist": True, + "show_playlist": True } if "art" not in config.sections(): - config["art"] = {"image_method": "pixcat"} + config["art"] = {"image_method": "pixcat", + "mpd_method": "albumart" + } if "mpd" not in config.sections(): config["mpd"] = {"host": "localhost", @@ -97,6 +99,7 @@ MPDPASS = mpd_config.get("pass", False) # What to use to draw images IMAGEMETHOD = art_config.get("image_method", "pixcat") +MPDMETHOD = art_config.get("mpd_method", "albumart") # Volume step VOLUMESTEP = player_config.getint("volume_step", 5) @@ -499,8 +502,13 @@ class Player: A function that fetches the album art and saves it to self.album_art_loc """ + try: - albumart_data = self.client.albumart(song_file) + if MPDMETHOD == "albumart": + albumart_data = self.client.albumart(song_file) + + elif MPDMETHOD == "readpicture": + albumart_data = self.client.readpicture(song_file) with open(self.album_art_loc, "wb") as f: f.write(albumart_data["binary"]) @@ -509,6 +517,7 @@ class Player: self.drawDefaultAlbumArt() + def drawDefaultAlbumArt(self): foregroundCol = "#D8DEE9" backgroundCol = "#262A33"