fruitcombo

go back

change xfce wallpaper to vlc or musikcube's current album art

all i want is to look at album art, huge.

i especially like this script for musikcube since it can't display images on its own but does cache album art. other than xfce and vlc or musikcube, you'll need playerctl, a program that controls media players. to find the name of your monitor/s, use xfconf-query --channel xfce4-desktop --list. you can download the vlc version of this script here and the musikcube version here.

#! /bin/bash
# capture original wallpapers so they can be restored later
 originalwall1=$(xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorDVI-I-1/workspace0/last-image)
 originalwall2=$(xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorHDMI-0/workspace0/last-image)

vlcplaying() {
# sed... everything...!! (music titles and the way vlc displays them have lots of problematic characters)
 nowplaying=$(playerctl --player=vlc metadata mpris:artUrl | sed 's/.......//' | sed 's/%20/\ /g' | sed 's/%21/\!/g' | sed 's/%2C/\,/g' | sed 's/%27/\x27/g' | sed 's/%28/\(/g' | sed 's/%29/\)/g')
 xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorDVI-I-1/workspace0/last-image -s "$nowplaying"
 xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorHDMI-0/workspace0/last-image -s "$nowplaying"
}

vlcstopped() {
 xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorDVI-I-1/workspace0/last-image -s "$originalwall1"
 xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorHDMI-0/workspace0/last-image -s "$originalwall2"
}

while true
 do
  if [[ $(playerctl status --player=vlc --no-messages) = Playing ]]; then
   vlcplaying
  else
   vlcstopped
  fi
 done
# stop playing vlc before ending this script to restore your original wallpapers

getting high quality album art

obviously, this works best with very high quality album art (or small displays, lol). if you want to fix up your collection's embedded artwork, you can download hq art from here and then embed it with programs like easytag or ffmpeg. here is my script for ffmpeg, just make the filetypes are appropriate, drop the art you want to embed into the album folder and run the script there. be warned it overwrites the original files. download here

#! /bin/bash
# erase old album art
 for file in *.mp3; do
  ffmpeg -i "$file" -map 0:a -c:a copy "copy-$file"
  mv "copy-$file" "$file"
 done
# embed new album art
 for file in *.mp3; do
  ffmpeg -i "$file" -i "$(find . -maxdepth 1 -type f -name '*.jpg' -o -name '*.png' | tail -1)" -c copy -map 0 -map 1 "copy-$file"
  mv "copy-$file" "$file"
 done

unlike most players vlc doesn't read directly from the files, but caches the first image it associates with an album, so after updating your collection, you should clear vlc's album art cache with rm -r $HOME/.cache/vlc/art.