mpd_del_album

stderr

#!/bin/sh

IFS="$(printf '\n\t')"
mpd_del_album_artist="$@"

[ -z $mpd_del_album_artist ] \
  && mpd_del_album_artist=$(mpc --format '%artist%' | head -1)

export mpd_del_album_artist
base=/mnt/Music_1
album="$(mpc --format '%file%'|head -1 | perl -pe 's{(.+)/.+$}{$1}')"

printf "Remove:\n \e[38;5;30m$album\e[m ? [y/N] "
read answer;

if [[ $answer != 'y' ]]; then
  warn 'bailing out'
else
  rmc "$base/$album"

  more_albums=$(mpc search artist "$mpd_del_album_artist" \
    | perl -pe 's{(.+)/.+$}{$1}' \
    | sort -u \
    | grep -vF "$album" \
    | grep -vP '^(Music_[1-7]/)?(VA|OST|GAME|.new)/')

  if [[ -n $more_albums ]]; then
    perl -e '
      warn "=" x 80, "\n";
      printf "Found additional albums by \e[1m%s\e[m:\n",
        $ENV{mpd_del_album_artist},
    '
    for next_album in $more_albums; do
      printf " \e[38;5;30m$next_album\e[m [y/N] "
      read answer
      if [[ $answer != 'y' ]]; then
        continue
      else
        rmc "$base/$next_album"
      fi
    done
  else
    exit
  fi
fi

unset -v mpd_del_album_artist