Pour ceux qui écoutent la radio avec radiotray un conky avec affichage de la pochette du titre joué .
Le conkyrc :
Code : Tout sélectionner
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_color 000000
own_window_argb_visual yes
#own_window_argb_value 0
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 300
maximum_width 250
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment top_right
gap_x 0
gap_y 580
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
imlib_cache_flush_interval 60
imlib_cache_size 500
# Taille des pointillés
stippled_borders 5
# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black
lua_load ~/.conky/lua/image.lua
TEXT
${voffset -25}${font URW Chancery L:style=Bold:size=20}${alignc}Radiotray ${font}
Radio : ${alignc}${font URW Chancery L:style=Bold:size=12}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}$font
${alignc}${voffset 50}En ce moment :
${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40 }
${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40 > ~/.conky/radiotray/artiste_titre.txt}
${texeci 20 ~/.conky/radiotray/image.sh}
${lua fDrawImage ~/.conky/radiotray/image.png 50 150 150 150 }
Code : Tout sélectionner
#!/bin/bash
# créer par loutch et WW
titre=$(head --lines=1 ~/.conky/radiotray/artiste_titre.txt)
# Ajout d'un compteur si jamais tu veux faire défiler plusieurs images
count=1
imageLink=$(wget --user-agent 'Firefox/38.0' -qO - "https://www.google.fr/search?q=${titre}\&tbm=isch" |\
sed 's/</\n</g' | grep "a href=\"http://www.google.fr/imgres?imgurl=" | head --lines=${count} |\
sed 's!.*http://www.google.fr/imgres?imgurl=\([^&]*\).*!\1!')
wget --output-document="googleImage".jpg $imageLink
convert ~/googleImage.jpg ~/.conky/radiotray/image.png
exit
@+