All pastes #1986880 Raw Edit

Add/Remove Covers To FLAC Files

public text v1 · immutable
#1986880 ·published 2010-11-10 00:33 UTC
rendered paste body
##FLAC
format=$1
if [ "$format" = "addcover" ]; then
find . -name '*.flac' | while read filepath
do
  parent=${filepath%/*}
  grandparent=${parent%/*}
  album=$(echo ${parent##*/})
  artist=$(echo ${grandparent##*/})

  metaflac --import-picture-from="${artist}/${album}/cover.png" "$filepath"

done

fi

##FLAC
format=$1
if [ "$format" = "removecover" ]; then
find . -name '*.flac' | while read filepath
do
  parent=${filepath%/*}
  grandparent=${parent%/*}
  album=$(echo ${parent##*/})
  artist=$(echo ${grandparent##*/})

  metaflac --remove --block-type=PICTURE "$filepath"

done

fi