Re: Images in Conky (specifically rhythmbox album art)
I modded the script below so it will only download and save ~/.album if the artist and album title have changed since the last time you $excei this script. for those who use $execi so you can refresh your currently playing song and cover art. without this mod you'll download the same cover repeatedly putting unneeded strain on your network and system resources. Also note, that my conkyrc uses ${if_running rhythmbox} so it wont load it on startup.
#!/bin/bash
artist=`rhythmbox-client --print-playing-format %ta`
album=`rhythmbox-client --print-playing-format %aa`
str="`echo "$artist $album" | sed -e s/\\ /+/g`"
wget `wget "http://www.albumart.org/index.php?srchkey=$str&itempage=1&newsearch=1&searchindex=Music" -q -O - |
grep "http://www.albumart.org/images/zoom-icon.jpg" -m 1 |
sed -e 's/" border="0" class="image_border.*//' |
sed -e 's/.*img src="//'` -q -O /home/jack/.albumi called it albumart, gave it a chmod +x, then stuck it in ~/bin , then put this in conkyrc
${exec albumart}${image /home/jack/.album -p 0,110 -s 64x64}this is what it looks like:
save this image as "~/.notplaying" so you have something to show when there's nothing playing or rhythmbox is shutdown.
name this in ".getcover" in "~/bin/"
#!/bin/bash +x
artist=`rhythmbox-client --print-playing-format %ta`
album=`rhythmbox-client --print-playing-format %at`
lastfetch=`cat ~/.covercheck | grep "$artist $album"`
if [[ $lastfetch == "$artist $album" ]]; then
exit 1
else
str="`echo $artist $album | sed -e s/\\ /+/g`"
wget `wget "http://www.albumart.org/index.php?srchkey=$str&itempage=1&newsearch=1&searchindex=Music" -q -O - |
grep "http://www.albumart.org/images/zoom-icon.jpg" -m 1 |
sed -e 's/" border="0" class="image_border.*//' |
sed -e 's/.*img src="//'` -q -O ~/.album
echo "$artist $album" > ~/.covercheck
fiheres my RC file
## System interaction
double_buffer yes
text_buffer_size 512
update_interval 1
## Font setup
use_xft yes
xftfont Bitstream Sans:size=10
default_color 000000
uppercase no
draw_shades no
## Window setup
alignment bottom_left
maximum_width 500
minimum_size 300 100
own_window yes
own_window_transparent yes
own_window_type override # Try also 'normal' or 'override'
gap_x 5
gap_y 5
TEXT
${voffset -35}${image ~/.notplaying -p 0,2 -s 100x100 -f 30}
${if_running rhythmbox}
${if_match "${exec rhythmbox-client --print-playing-format %tt}" == "Not playing"}
${voffset -35}${image ~/.notplaying -p 0,2 -s 100x100 -f 30}
${offset 105}No Track
$else
${execi 15 ~/bin/getcover}
${voffset -50}${image ~/.album -p 0,2 -s 100x100 -f 30}
${offset 105}$color${execi 30 rhythmbox-client --print-playing-format %tt}
${offset 105}$color${execi 30 rhythmbox-client --print-playing-format %ta}
${offset 105}$color${execi 30 rhythmbox-client --print-playing-format %at} (${execi 30 rhythmbox-client --print-playing-format %ay})
${offset 105}$color${execi 30 rhythmbox-client --print-playing-format %te} / ${execi 30 rhythmbox-client --print-playing-format %td}$endif$endif