PDA

View Full Version : Multiple album art formats supported?



kyleki
2006-10-27, 09:45
All of my music is organized on the file system as: ARTIST/ALBUM/SONGS.
Within the ALBUM folder I have either a cover.jpg or cover.png file. With the
default settings, the only album art shown to me in the fishbone skin are the
cover.jpg files. None of my cover.png files are being seen.

What do I need to do to get all album art displayed?

Thanks,
Kyle

slimpy
2006-10-27, 16:29
Convert to jpg.
If you run linux you might have the netpbm graphic tools already installed.
Use this command to convert cover.png to cover.jpg:

pngtopnm cover.png | pnmtojpeg > cover.jpg
There should be binaries for windows available at the project website, too.
http://netpbm.sourceforge.net

-s.

slimpy
2006-10-27, 16:43
The following script traverses your file system recursively and calls the conversion command in every directory.
Yust point it at the root of your music library and let it do its work (if you're on linux).

-s.


#!/bin/sh

traverse()
{
# Traverse a directory
cd "$1"
pngtopnm cover.png | pnmtojpeg > cover.jpg
ls | while read i
do
if [ -d "$i" ]; then
echo "Directory: $i"
# Calling this as a subshell means that when the called
# function changes directory, it will not affect our
# current working directory
(traverse "$i" `expr $2 + 1`)
fi
done
}

if [ -z "$1" ]; then
traverse . 0
else
traverse "$1" 0
fi

kyleki
2006-10-28, 11:05
The following script traverses your file system recursively and calls the conversion command in every directory.

Thanks. I am running Linux (FC4) so this will work.

I guess I feel like slimserver should support multiple formats so we don't have to
do things like this. Why wouldn't it display anything found with a basename of 'cover',
'folder', or a custom name defined in the settings with any one of the following extensions:
jpg, gif, png, (etc?)?

kyleki
2006-10-30, 14:25
I've slightly modified the code you gave me to add a little extra logic in determining
when it should do the image conversion. It will also remove a cover.png file that
exists in the same folder that a cover.jpg is in, leaving just the .jpg version.



#!/bin/sh

traverse()
{
# Traverse a directory
cd "$1"
if [ -s "cover.png" ]; then
if [ ! -s "cover.jpg" ]; then
pngtopnm cover.png | pnmtojpeg > cover.jpg
fi
/bin/rm -f cover.png
fi
ls | while read i
do
if [ -d "$i" ]; then
echo "Directory: $i"
# Calling this as a subshell means that when the called
# function changes directory, it will not affect our
# current working directory
(traverse "$i" `expr $2 + 1`)
fi
done
}

if [ -z "$1" ]; then
traverse . 0
else
traverse "$1" 0
fi

Thanks a lot for your pointer in this area as it seems to be working well.
I am still curious, however, if this conversion should be necessary. Does
anyone have an opinion on this?