#!/bin/bash # get Amarok cover art of current track and transform into an album stack # copypasta from http://www.imagemagick.org/Usage/thumbnails/#polaroid # thanks to eightmillion for completely rewriting the script # http://ubuntuforums.org/showpost.php?p=8117609&postcount=9846 # Temp directory must be full path. tempdir="$HOME/conky/cover/" tempfile="${tempdir}nowplaying" [ -d "$tempdir" ] || mkdir -p "$tempdir" #test if $tempdir exists, if not create it. [ -e "$tempfile" ] || touch "$tempfile" cover="$(dcop amarok player coverImage)" [ -z "$cover" ] && exit #test if $cover was set, if not exit. hash=$(echo "$cover" | md5sum | cut -d" " -f 1) #Generate hash for current song. read oldhash < "$tempfile" if [ "$oldhash" == "$hash" ];then : else convert ${cover} -bordercolor white -border 6 -bordercolor grey60 -border 1 -bordercolor none -background none \( -clone 0 -rotate `convert null: -format '%[fx:rand()*20-15]' info:` \) \( -clone 0 -rotate `convert null: -format '%[fx:rand()*20-15]' info:` \) \( -clone 0 -rotate `convert null: -format '%[fx:rand()*20-15]' info:` \) \( -clone 0 -rotate `convert null: -format '%[fx:rand()*20-15]' info:` \) -delete 0 -border 100x80 -gravity center -crop 200x160+0+0 +repage -flatten -trim +repage -background black \( +clone -shadow 60x4+4+4 \) +swap -background none -flatten -resize 150x150 "${tempdir}cover.png" echo $hash > "$tempfile" fi exit