Compare commits

...

10 Commits

Author SHA1 Message Date
a15f21b5dc Use mpd's readpicture as default, fallback to albumart 2022-11-13 15:36:11 -06:00
7b69a16ced Remove trailing whitespaces 2022-11-13 15:12:58 -06:00
8caaedbc5e Remove extra commas 2022-11-13 15:09:12 -06:00
8daa39ff02 Revert changes 2022-11-13 15:00:00 -06:00
3e26cfe037 Fix spacing, edit md table 2022-11-13 00:01:31 -06:00
5ef6cb51f4 Fix Readme formatting 2022-11-12 23:42:04 -06:00
732edec12e Remove extra newline 2022-11-12 23:34:37 -06:00
9558ad0d97 Add readpicture mpd function option to miniplayer 2022-11-12 23:32:11 -06:00
4f558bf137 Update Readme, config.example 2022-11-12 23:18:54 -06:00
d1c7b4de6e Flush input buffers before first loop 2022-10-04 21:32:14 +00:00

View File

@ -22,7 +22,7 @@ if "player" not in config.sections():
"album_art_only": False, "album_art_only": False,
"volume_step": 5, "volume_step": 5,
"auto_close": False, "auto_close": False,
"show_playlist": True, "show_playlist": True
} }
if "art" not in config.sections(): if "art" not in config.sections():
@ -30,7 +30,7 @@ if "art" not in config.sections():
if "mpd" not in config.sections(): if "mpd" not in config.sections():
config["mpd"] = {"host": "localhost", config["mpd"] = {"host": "localhost",
"port": "6600", "port": "6600"
} }
if "theme" not in config.sections(): if "theme" not in config.sections():
@ -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()
@ -1052,6 +1067,8 @@ class Player:
"art", "art",
scaler=ueberzug.ScalerOption.FIT_CONTAIN.value scaler=ueberzug.ScalerOption.FIT_CONTAIN.value
) )
# Flush all input
curses.flushinp()
# Check if we need to recalculate window size # Check if we need to recalculate window size
# because of album art only initially # because of album art only initially