Add readpicture mpd function option to miniplayer
This commit is contained in:
@ -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"
|
||||
|
Reference in New Issue
Block a user