You are not logged in.
i've been looking for this for a while, and thought others might be too, so i thought i'd give a quick run down on what i'm doing.

pretty, i know 
alright, first off, you gotta grab the conky source (http://sourceforge.net/projects/conky/files/), then extract it, ./configure it, with "--enable-imlib2" (source), then make and install it.
from there, install conkyRhythmbox by kaivalagi from this post (it has the album art option in it)
once everything's set, stick something like this in your .conkyrc:
${offset 69}${font AvantGardeLTMedium:size=10}${exec rhythmbox-client --print-playing-format %tt}
${offset 69}$color1${exec rhythmbox-client --print-playing-format %ta}$font${exec ret}
${exec cp "`conkyRhythmbox --datatype=CA | sed -e 's/\\\//g'`" /home/jack/.album}${image /home/jack/.album -p 0,2 -s 64x64}the last line is the important stuff. it copies the cached album art that rhythmbox uses to a static file that conky loads with the $image tag. you'll probably wanna stick in an "imlib_cache_size 0" in there as well so it doesn't cache the file.
this can work with any player really, as long as you can find the current song's album art location.
special thanks to kaivalagi and whoever did the conky.wikia page.
hope you find it useful.
Offline
Wow, that looks great. Thanks for sharing 
Online
some sort online album art repository would make it pretty easy to write something to fetch it. otherwise, might be tricky.
if you know of any good places, let me know, and i'll figure something out.
Offline
^^ http://www.albumart.org/ might be of use?
Offline
@corenominal perfect!
alright, so this is what i worked up.
#!/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}I'm not sure what happens if there isn't one found. it might explode.
but it basically searches for the artist and album, then displays the first image found. it's not that big, but i works for me.
lemme know if something doesn't work 
Last edited by aslamp (2009-07-26 00:51:19)
Offline
Nice work! Thank you for sharing. 
I'm not sure what happens if there isn't one found. it might explode.
I would not worry, that event is clearly covered in CrunchBang's disclaimer. 
Offline
I had to do a very slight modification of the script. I use moc as my media player, but it was simple enough to change the script to get the information from moc.
artist=`mocp -Q %artist`
album=`mocp -Q %album`I left the rest of the album art fetcher script untouched.
In my .conkyrc file, I am using
${exec bash /home/cam/.moc/moc-albumart.sh}${image /home/cam/.album -p 0,425 -s 64x64}to call up the image. The file on my hard drive, ~/.album, updates upon changing album. However, conky does not update the image, and as a side effect of the script running, only updates every 3-4 seconds instead of every second. I'm unsure as to how to change this. Perhaps change the script to first check if the image is different? I might also see if I can get moc to execute the album art fetcher upon song change.
In case there is no album art found, would it be possible to have wget, upon returning an error and not being able to fetch a file, delete the ~/.album file? Unfortunately, I don't know how to do this myself (due to my lack of knowledge about any kind of programming or scripting).
My blog
Offline
you'll need to change the exec statement to execi if you want it to update. Exec just runs once on conky startup.
I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.
Offline
i've been looking for this for a while, and thought others might be too, so i thought i'd give a quick run down on what i'm doing.
pretty, i know
alright, first off, you gotta grab the conky source (http://sourceforge.net/projects/conky/files/), then extract it, ./configure it, with "--enable-imlib2" (source), then make and install it.
from there, install conkyRhythmbox by kaivalagi from this post (it has the album art option in it)
once everything's set, stick something like this in your .conkyrc:
${offset 69}${font AvantGardeLTMedium:size=10}${exec rhythmbox-client --print-playing-format %tt} ${offset 69}$color1${exec rhythmbox-client --print-playing-format %ta}$font${exec ret} ${exec cp "`conkyRhythmbox --datatype=CA | sed -e 's/\\\//g'`" /home/jack/.album}${image /home/jack/.album -p 0,2 -s 64x64}the last line is the important stuff. it copies the cached album art that rhythmbox uses to a static file that conky loads with the $image tag. you'll probably wanna stick in an "imlib_cache_size 0" in there as well so it doesn't cache the file.
this can work with any player really, as long as you can find the current song's album art location.
special thanks to kaivalagi and whoever did the conky.wikia page.
hope you find it useful.
would it be possible to grab your entire conky config files? I rather like yours from the screenshot.
Offline
This is the second screenshot (the whiteish one). I don't have the brown one anymore, but if you can't figure anything out from this one to change it, let me know!
It uses a gmail script, conkyGoogleReader and conkyForecast
background yes
use_xft yes
xftfont AvantGardeLTMedium:size=8
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders no
default_shade_color black
default_outline_color white
default_bar_size 20 20
default_gauge_size 20 20
imlib_cache_size 0
default_color D7D3C5
color1 9f907d
default_color 444444
color1 888888
draw_shades no
alignment bottom_left
gap_x 5
gap_y 0
no_buffers yes
uppercase yes
cpu_avg_samples 2
override_utf8_locale no
TEXT
${offset 69}${font AvantGardeLTMedium:size=10}${exec rhythmbox-client --print-playing-format %tt}
${offset 69}$color1${exec rhythmbox-client --print-playing-format %ta}$font${exec ret}
${execi 1 albumart}${image /home/jack/.album -p 0,0 -s 64x64}
$color${execi 30 python ~/bin/gmail.py}$color1 new messages
$color${execi 30 python ~/bin/conkyGoogleReader.py --username=gmail --password=password}$color1 unread items
${image /home/jack/images/gr -p 0,91 -s 16x16}${image /home/jack/images/gm -p 1,77 -s 14x14}
${color1}Uptime $color$uptime
${color1}Root $color${fs_free /} Free
${color1}home $color${fs_free /media/home/} Free
${color1}CPU $color${cpu cpu0}% / ${cpu cpu1}%
${color1}RAM $color$memfree Free
$color1${execi 60 conkyForecast -l USIN0211 -d CC} $color${execi 60 conkyForecast -l USIN0211 -d HT -i -u -x -e 3}F
$color${font AvantGardeLTMedium:size=24}${time %l:%M} $font$color1${Time %a %d %b}gmail.py:
import os
import string
#Enter your username and password below within double quotes
# eg. username="username" and password="password"
username=""
password=""
com="wget -O - https://"+username+":"+password+"@mail.google.com/mail/feed/atom --no-check-certificate"
temp=os.popen(com)
msg=temp.read()
index=string.find(msg,"<fullcount>")
index2=string.find(msg,"</fullcount>")
fc=int(msg[index+11:index2])
if fc==0:
print "0"
else:
print str(fc)Offline
this is awesome 
could you help me, make this work for sonata/mpd ?
Offline
I'm actually trying to make the switch over to that right now
i'll post when i get it pretty =]
Offline
that's good news
i've found a script over at archlinux, that shows the albumart from the .covers folder that sonata uses, but i want see if there is a way to put your fetching script too, so it downloads the covers from the net.
goodluck 
Offline
here you go:
#!/usr/bin/python
import os,commands, urllib
home = os.getenv("HOME")
artist=commands.getoutput("mocp -Q %artist").replace(" ", "+")
album=commands.getoutput("mocp -Q %album").replace(" ", "+")
if artist == "" and album == "":
if os.path.exists(home + "/.album"):
os.remove(home + "/.album")
else:
url = "http://www.albumart.org/index.php?srchkey=" + artist + "+" + album + "&itempage=1&newsearch=1&searchindex=Music"
albumart = urllib.urlopen(url).read()
image = ""
for line in albumart.split("\n"):
if "http://www.albumart.org/images/zoom-icon.jpg" in line:
image = line.partition('src="')[2].partition('"')[0]
break
if image:
if os.path.exists("/tmp/imagepath"):
imagepath = open("/tmp/imagepath").read()
if imagepath == image:
pass
else:
urllib.urlretrieve(image, home + "/.album")
else:
urllib.urlretrieve(image, home + "/.album")
open("/tmp/imagepath","w").write(image)
else:
if os.path.exists(home + "/.album"):
os.remove(home + "/.album")should now delete the album if it can't find one. If anyone can think of improvements let me know.
edit: forgot to mention that its setup for moc since thats what I use. I may change it later to support other players with a command line switch, but for now you should be able to figure out how to change the artist and album line.
edit: modified it so it doesn't redownload the album art every couple seconds.
I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.
Offline
Traceback (most recent call last):
File "/home/geo/test.py", line 15, in <module>
albumart = urllib.urlopen(url).read()
File "/usr/lib/python2.6/urllib.py", line 87, in urlopen
return opener.open(url)
File "/usr/lib/python2.6/urllib.py", line 203, in open
return getattr(self, name)(url)
File "/usr/lib/python2.6/urllib.py", line 318, in open_http
if not host: raise IOError, ('http error', 'no host given')
i get this error
Offline
hmmm that's weird, I've tried it with moc not running and it just returns nothing, no error though. what song were you playing at the time? Are you using moc?
edit: fixed one bug in it, if you play a song with no album cover then play another song from the last album you played it wont redownload the cover....heres the fix
#!/usr/bin/python
import os,commands, urllib
home = os.getenv("HOME")
artist=commands.getoutput("mocp -Q %artist").replace(" ", "+")
album=commands.getoutput("mocp -Q %album").replace(" ", "+")
if artist == "" and album == "":
if os.path.exists(home + "/.album"):
os.remove(home + "/.album")
else:
url = "http://www.albumart.org/index.php?srchkey=" + artist + "+" + album + "&itempage=1&newsearch=1&searchindex=Music"
albumart = urllib.urlopen(url).read()
image = ""
for line in albumart.split("\n"):
if "http://www.albumart.org/images/zoom-icon.jpg" in line:
image = line.partition('src="')[2].partition('"')[0]
break
if image:
if os.path.exists("/tmp/imagepath") and os.path.exists(home + "/.album"):
imagepath = open("/tmp/imagepath").read()
if imagepath == image:
pass
else:
urllib.urlretrieve(image, home + "/.album")
else:
urllib.urlretrieve(image, home + "/.album")
open("/tmp/imagepath","w").write(image)
else:
if os.path.exists(home + "/.album"):
os.remove(home + "/.album")I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.
Offline
hi again
i've used both mocp and sonata/mpc and i get the same error
but i think the error is caused by python
meaning i've changed
albumart = urllib.urlopen(url).read()with
albumart = urllib2.urlopen(url).read()and i got rid of that error but i still have some issues.
strange...hmmm now it works alright with urllib, but no album art shows up, at least i get no errors regarding the code
again edit 
got it now
i had some wrong in conky
and as for mpd, you can put this
artist=commands.getoutput("mpc --format %artist% | head -n 1").replace(" ", "+")
album=commands.getoutput("mpc --format %album% | head -n 1").replace(" ", "+")thank you 
Last edited by geoisis (2009-08-02 00:36:46)
Offline
This is the second screenshot (the whiteish one). I don't have the brown one anymore, but if you can't figure anything out from this one to change it, let me know!
It uses a gmail script, conkyGoogleReader and conkyForecast
background yes use_xft yes xftfont AvantGardeLTMedium:size=8 xftalpha 1 update_interval 1.0 total_run_times 0 own_window yes own_window_transparent yes own_window_type desktop own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager double_buffer yes minimum_size 200 200 draw_shades yes draw_outline no draw_borders no draw_graph_borders no default_shade_color black default_outline_color white default_bar_size 20 20 default_gauge_size 20 20 imlib_cache_size 0 default_color D7D3C5 color1 9f907d default_color 444444 color1 888888 draw_shades no alignment bottom_left gap_x 5 gap_y 0 no_buffers yes uppercase yes cpu_avg_samples 2 override_utf8_locale no TEXT ${offset 69}${font AvantGardeLTMedium:size=10}${exec rhythmbox-client --print-playing-format %tt} ${offset 69}$color1${exec rhythmbox-client --print-playing-format %ta}$font${exec ret} ${execi 1 albumart}${image /home/jack/.album -p 0,0 -s 64x64} $color${execi 30 python ~/bin/gmail.py}$color1 new messages $color${execi 30 python ~/bin/conkyGoogleReader.py --username=gmail --password=password}$color1 unread items ${image /home/jack/images/gr -p 0,91 -s 16x16}${image /home/jack/images/gm -p 1,77 -s 14x14} ${color1}Uptime $color$uptime ${color1}Root $color${fs_free /} Free ${color1}home $color${fs_free /media/home/} Free ${color1}CPU $color${cpu cpu0}% / ${cpu cpu1}% ${color1}RAM $color$memfree Free $color1${execi 60 conkyForecast -l USIN0211 -d CC} $color${execi 60 conkyForecast -l USIN0211 -d HT -i -u -x -e 3}F $color${font AvantGardeLTMedium:size=24}${time %l:%M} $font$color1${Time %a %d %b}gmail.py:
import os import string #Enter your username and password below within double quotes # eg. username="username" and password="password" username="" password="" com="wget -O - https://"+username+":"+password+"@mail.google.com/mail/feed/atom --no-check-certificate" temp=os.popen(com) msg=temp.read() index=string.find(msg,"<fullcount>") index2=string.find(msg,"</fullcount>") fc=int(msg[index+11:index2]) if fc==0: print "0" else: print str(fc)
amazing, thank you very much ^^ gotta love the linux community and the sharing ^^
Offline
glad it's working for you geoisis, that's weird that it works for me with just urllib and you have to change it to urllib2. Oh well as long as it works.
I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.
Offline
it works with urllib also now
.
also i was thinking, fetching album covers from last.fm and also artist image
, but my knowledge is not so good with python.
Offline
What would be the best way to get album art in conky, if you are using QuodLibet?
HANNA (without "h" in the end) likes green and #! 
Also know as ultraturquoise online / #! last.fm / #! DeviantART / U
Offline
http://code.google.com/p/python-lastfm/ found this
. python to work with the last.fm API.
Offline
heres http://crunchbanglinux.org/pastebin/291 a new copy that makes it look nice and add's the artist, title, and album to the picture. Heres a screenshot:
just need to find a font that looks a little better.
edit: forgot to mention you need to save this http://ecx.images-amazon.com/images/I/11J2DMYABHL.jpg image as .noalbum in your home folder. If it can't find an album this is the one it uses.
edit again: fixed a bug in it, the pastebin is updated now
last edit: would everyone like me to switch over to last.fm? theres a lot more info easily searchable...but you would have to get an api key
I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.