I am using bash to get some information from audacious to conky for display (including album art). I get the path to the directory of the music file from audacious, then attempt to cd to that directory to find folder.jpg - if found, prepare for display. Unfortunately can't rely on 'well-formed' path names. None of them have a problem from terminal, but the evaluations that bash does... It chokes on doubled spaces ( ) ' / and probably others, although the current setup seems to handle - ok. Here's the relevant function:
GetArt ()
{
file_path=`audtool --current-song-tuple-data file-path` # get the path to the song
file_path=$(eval echo "${file_path}") # pre-expand to full path
cd "${file_path}"
if [[ ! -e "folder.jpg" ]]; # if no art work found
then
cp ~/Work/vinyl.png /tmp/cover.png # put in placeholder
else
convert "${file_path}""/folder.jpg" -resize 120x120 /tmp/cover.png # ready for showing
fi
}
Any ideas, or would getting out the wire brush and removing the rust from my 'C' compiler be easier?
I tried with double quotes, single quotes, backticks, and even a construct like:
code=$code \"\$filename\""
but nothing seems to work correctly as yet. Fortunately it fails 'pretty' because it just pops up the "can't find art" substitute pic instead, but sometimes things burp all over stderr until the next song - or album.