Added possibility to configure what art filenames to try with webserver call
This commit is contained in:
@ -37,6 +37,7 @@ The config file is located at `~/.config/miniplayer/config`. The example configu
|
|||||||
#### art
|
#### art
|
||||||
* ***music_directory*:** The path to your music directory for extracting album art from the files.
|
* ***music_directory*:** The path to your music directory for extracting album art from the files.
|
||||||
* ***http_base_url*:** Base URL of webserver which serves the album art for your albums (takes precedence over `music_directory`). Useful for users of Android MPD clients _MAFA_ or _MPDroid_. For more information see [the MPDroid wiki](https://github.com/abarisain/dmix/wiki/Album-Art-on-your-LAN).
|
* ***http_base_url*:** Base URL of webserver which serves the album art for your albums (takes precedence over `music_directory`). Useful for users of Android MPD clients _MAFA_ or _MPDroid_. For more information see [the MPDroid wiki](https://github.com/abarisain/dmix/wiki/Album-Art-on-your-LAN).
|
||||||
|
* ***http_cover_filenames*:** Space separated list of filenames to use in the call to the webserver to fetch the album art.
|
||||||
* ***image_method*:** The method to use for drawing album art. Available values are `pixcat` and `ueberzug`
|
* ***image_method*:** The method to use for drawing album art. Available values are `pixcat` and `ueberzug`
|
||||||
If you are not using Kitty, try `ueberzug`.
|
If you are not using Kitty, try `ueberzug`.
|
||||||
|
|
||||||
|
@ -337,17 +337,23 @@ class Player:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
album = os.path.dirname(song_file)
|
album = os.path.dirname(song_file)
|
||||||
album_art_url = posixpath.join(base_url, album, "cover.jpg")
|
|
||||||
|
for cover_filename in art_config.get("http_cover_filenames").split():
|
||||||
|
album_art_url = posixpath.join(base_url, album, cover_filename)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
album_art_resp = requests.get(album_art_url)
|
album_art_resp = requests.get(album_art_url)
|
||||||
except requests.RequestException:
|
except requests.RequestException:
|
||||||
# If any exception occurs, simply give up and show default art.
|
# If any exception occurs, simply give up and show default art.
|
||||||
self.drawDefaultAlbumArt()
|
self.drawDefaultAlbumArt()
|
||||||
|
break
|
||||||
|
|
||||||
if album_art_resp.ok:
|
if album_art_resp.ok:
|
||||||
with open(self.album_art_loc, "wb") as f:
|
with open(self.album_art_loc, "wb") as f:
|
||||||
f.write(album_art_resp.content)
|
f.write(album_art_resp.content)
|
||||||
|
break
|
||||||
|
elif album_art_resp.status_code == 404:
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
self.drawDefaultAlbumArt()
|
self.drawDefaultAlbumArt()
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ show_playlist = true
|
|||||||
image_method = pixcat
|
image_method = pixcat
|
||||||
music_directory = ~/Music
|
music_directory = ~/Music
|
||||||
# http_base_url = http://localhost:6667/cover-art
|
# http_base_url = http://localhost:6667/cover-art
|
||||||
|
# http_cover_filenames = cover.jpg cover.png folder.jpg folder.png art.jpg art.png artwork.jpg artwork.png
|
||||||
|
|
||||||
[mpd]
|
[mpd]
|
||||||
host = localhost
|
host = localhost
|
||||||
|
Reference in New Issue
Block a user