diff options
Diffstat (limited to '')
-rw-r--r-- | .config/conkyrc | 2 | ||||
-rwxr-xr-x | .local/bin/conky_cover.sh | 26 |
2 files changed, 14 insertions, 14 deletions
diff --git a/.config/conkyrc b/.config/conkyrc index f56e647..3a03a77 100644 --- a/.config/conkyrc +++ b/.config/conkyrc @@ -57,7 +57,7 @@ ${color grey}${alignc}MPD ${font1}${color white}${goto 140}${mpd_artist} ${goto 140}${mpd_title} ${goto 140}${mpd_elapsed}/${mpd_length} ${mpd_bar} -${execi 5 ~/.local/bin/conky_cover.sh >/dev/null 2>&1}${image /tmp/conkyCover.png -p 20,40 -n} +${execi 5 ~/.local/bin/conky_cover.sh >/dev/null 2>&1}${image /tmp/conkyCover.png -p 20,150 -n} ${hr}${endif}${if_up re0} ${font2}${color white}${alignc}${execi 1800 curl wttr.in/Lyon?T0 --silent --max-time 3}${font} ${hr}${endif} diff --git a/.local/bin/conky_cover.sh b/.local/bin/conky_cover.sh index 571a240..ffdd403 100755 --- a/.local/bin/conky_cover.sh +++ b/.local/bin/conky_cover.sh @@ -9,11 +9,12 @@ ## CONFIGURATION ## # Folder for cached album art # Don't use ~, as conky will treat it as a regular directory name -CACHE="$HOME/.cache/covers" +# CACHE="$HOME/.cache/covers" # API Key for Last.fm -APIKEY="b25b959554ed76058ac220b7b2e0a026" +# APIKEY="b25b959554ed76058ac220b7b2e0a026" # Log file, only for debugging purposes LOG=/tmp/conky-mpd.log +TMP=/tmp/conkympd.tmp # Check for vital commands # CMD="mpc curl convert" @@ -22,20 +23,19 @@ LOG=/tmp/conky-mpd.log # done # [ ! -d "$CACHE" ] && mkdir -p "$CACHE" -ARTIST="$(mpc --format %artist% | head -1)" -ALBUM="$(mpc --format %album% | head -1)" -FILEDIR="$(dirname "$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)")" +playing="$(mpc --format '%artist% - %album%' | head -1)" +filedir="$(dirname "$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)")" -TMP=/tmp/conkympd.tmp [ ! -f $TMP ] && touch $TMP -[ "$(cat $TMP)" == "$ARTIST+$ALBUM" ] && echo "Same artist/album." >> $LOG && exit 0 -echo "Artist/album changed: $ALBUM by $ARTIST" >> $LOG +[ "$(cat $TMP)" == "$playing" ] && exit 0 +# [ "$(cat $TMP)" == "$playing" ] && echo "Same artist/album" >> $LOG && exit 0 +# echo "Artist/album changed: $playing" >> $LOG #[ -f "/tmp/conkyCover.png" ] && rm "/tmp/conkyCover.png" cp $HOME/.config/conky-mpd/nocover.png /tmp/conkyCover.png -echo "NoCover" >> $LOG +# echo "NoCover" >> $LOG -coverfile="$(find "$FILEDIR" -maxdepth 1 -type f \( -iname 'cover.jpg' -o -iname 'cover.png' -o -iname 'folder.jpg' -o -iname 'folder.png' -o -iname '*.jpg' -o -iname '*.png' \) -print -quit)" +coverfile="$(find "$filedir" -maxdepth 1 -type f \( -iname 'cover.jpg' -o -iname 'cover.png' -o -iname 'folder.jpg' -o -iname 'folder.png' -o -iname '*.jpg' -o -iname '*.png' \) -print -quit)" #COVER="$CACHE/$ARTIST - $ALBUM.jpg" ## Is cover cached? #if [ ! -f "$COVER" ]; then @@ -50,7 +50,7 @@ coverfile="$(find "$FILEDIR" -maxdepth 1 -type f \( -iname 'cover.jpg' -o -iname # echo "Downloaded to $COVER." >> $LOG #fi # Copy cache for processing -echo "Copying $coverfile." >> $LOG +# echo "Copying $coverfile." >> $LOG # cp "$COVER" /tmp/cover.jpg # Downscale to fit overlay # convert /tmp/cover.jpg -resize 366 /tmp/cover.png >> $LOG @@ -60,8 +60,8 @@ echo "Copying $coverfile." >> $LOG #convert /tmp/cover.png $HOME/.config/conky-mpd/case.png -composite /tmp/cover.png >> $LOG ## Resize for immediate use # convert /tmp/cover.png -resize 120 /tmp/conkyCover.png >> $LOG -convert "$coverfile" -resize 100 /tmp/conkyCover.png >> $LOG +convert "$coverfile" -resize 100 /tmp/conkyCover.png # >> $LOG ## Set current artist -echo "$ARTIST+$ALBUM" > $TMP +echo "$playing" > $TMP #rm /tmp/cover.jpg /tmp/cover.png |