You are not logged in.
I love ncmpcpp but, sadly, it does not display all the beautiful album art I've collected. So I wrote this little Python script (80 lines) that does just that.
It monitors mpd and searches for an image in the directory of the currently playing file, but you have to tell it mpd's music directory (MUSICDIR). You set PATTERN as how your album art is named, in globbing format. In my case that's Folder.* for Folder.jpg or Folder.png
It also needs a default image (DEFAULTIMG) in case it doesn't find any album art.
It then displays that image and scales it to the window size. The image proportions are kept, so it might fill some space with a background color that you can set (BGCOLOR).
Close the window to quit.
It requires python-mpd2 from the AUR, python-pillow and tk. I'm not an enterprise programmer so forgive me if the code is shitty. In any case, it's simple and light.
https://github.com/rolf1304/albumart/
Last edited by doggone (2015-07-16 14:56:41)
Offline
This looks somewhat interesting but I can't seem to get album art to show up at all. I installed python-mpd2, python-pillow and tk. I set the default image and it shows just fine. I also get some tracebacks because of invalid character ranges and I wonder if it's related to my directory structure?
# Required variables
MUSICDIR = "/home/shn/music/"
PATTERN = "cover.*" <--- I have almost everything named as cover.jpg instead.
DEFAULTIMG = "/home/shn/.icons/default.png"
BGCOLOR = "#1c1e21"This is how I've organized my music directory:
/home/user/music/genre/artist - [yyyy.mm.dd] [catalog number] albumHere's the traceback I get in sometimes:
neko: ~ % albumart.py
Traceback (most recent call last):
File "/home/shn/.bin/albumart.py", line 62, in <module>
imgFrame = ImageFrame(root, get_albumart(client.currentsong()))
File "/home/shn/.bin/albumart.py", line 55, in get_albumart
for albumArt in glob.glob(MUSICDIR + aaDir + PATTERN):
File "/usr/lib/python3.4/glob.py", line 18, in glob
return list(iglob(pathname))
File "/usr/lib/python3.4/glob.py", line 53, in iglob
for dirname in dirs:
File "/usr/lib/python3.4/glob.py", line 54, in iglob
for name in glob_in_dir(dirname, basename):
File "/usr/lib/python3.4/glob.py", line 73, in glob1
return fnmatch.filter(names, pattern)
File "/usr/lib/python3.4/fnmatch.py", line 52, in filter
match = _compile_pattern(pat)
File "/usr/lib/python3.4/functools.py", line 472, in wrapper
result = user_function(*args, **kwds)
File "/usr/lib/python3.4/fnmatch.py", line 46, in _compile_pattern
return re.compile(res).match
File "/usr/lib/python3.4/re.py", line 223, in compile
return _compile(pattern, flags)
File "/usr/lib/python3.4/re.py", line 294, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.4/sre_compile.py", line 568, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.4/sre_parse.py", line 760, in parse
p = _parse_sub(source, pattern, 0)
File "/usr/lib/python3.4/sre_parse.py", line 370, in _parse_sub
itemsappend(_parse(source, state))
File "/usr/lib/python3.4/sre_parse.py", line 516, in _parse
raise error("bad character range")
sre_constants.error: bad character rangeOffline
This looks somewhat interesting but I can't seem to get album art to show up at all. I installed python-mpd2, python-pillow and tk. I set the default image and it shows just fine. I also get some tracebacks because of invalid character ranges and I wonder if it's related to my directory structure?
# Required variables MUSICDIR = "/home/shn/music/" PATTERN = "cover.*" <--- I have almost everything named as cover.jpg instead. DEFAULTIMG = "/home/shn/.icons/default.png" BGCOLOR = "#1c1e21"This is how I've organized my music directory:
/home/user/music/genre/artist - [yyyy.mm.dd] [catalog number] albumHere's the traceback I get in sometimes:
yeah that's a bug because of globbing characters in your albums' path names. I should have thought of that.
fixed it here: https://github.com/rolf1304/albumart
(the relevant line is
for albumArt in glob.glob(glob.escape(MUSICDIR + aaDir) + PATTERN):Offline
Thanks for the fix. Now it's working just fine and it warms my heart to see an album art while listening to some music ![]()
Offline