Advertisement
Dobbie03

Script

Sep 11th, 2021
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #! /bin/bash
  2. MUSIC_DIR=$HOME/Music/
  3. COVER=/tmp/cover2.png
  4.  
  5. { album="$(mpc --format %album% current)"
  6. file="$(mpc --format %file% current)"
  7. album_dir="${file%/*}"
  8. [[ -z "$album_dir" ]] && exit 1
  9. album_dir="$MUSIC_DIR/$album_dir"
  10.  
  11. covers="$(find "$album_dir" -type d -exec find {} -maxdepth 1 -type f -iregex ".*/.*\(${album}\|cover\|folder\|artwork\|front\).*[.]\(jpe?g\|png\|gif\|bmp\)" \; )"
  12. src="$(echo -n "$covers" | head -n1)"
  13. rm -f "$COVER"
  14. cp "$src" "$COVER"
  15. } &
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement