#! /bin/zsh # maintained in git.mdcc.cx ad1810-stuff # This file is in the Public Domain # Written by Joost van Baal, april 2010 verbose=${F2M_VERBOSE:-false} noact=${F2M_NOACT:-false} typeset -A tags for file in "$@" do OIFS=$IFS IFS== metaflac --export-tags-to=- "$file" | while read t v do # for tagname in YEAR ARTIST COMMENT ALBUM TITLE GENRE TRACKNUM $verbose && echo "setting tag '$t' to '$v'" tags["$t"]="$v" done IFS=$OIFS outfile=${file%.flac}.mp3 if test -f $outfile then echo "refusing to overwrite '$outfile'" break else $verbose && echo "writing output to '$outfile'" fi year=$tags["YEAR"] artist=$tags["ARTIST"] comment=$tags["COMMENT"] album=$tags["ALBUM"] title=$tags["TITLE"] genre=$tags["GENRE"] tracknum=$tags["TRACKNUM"] $verbose && echo gonna run lame --ty "$year" --ta "$artist" --tc "$comment" --tl "$album" --tt "$title" --tg "$genre" --tn $tracknum - "$outfile" flac -c -d "$file" | lame --ty "$year" --ta "$artist" --tc "$comment" --tl "$album" --tt "$title" --tg "$genre" --tn "$tracknum" - "$outfile" # flac -c -d "$file" | lame --alt-preset standard --ty "$year" --ta "$artist" --tc "$comment" --tl "$album" --tt "$title" --tg "$genre" --tn $tracknum - "$outfile" # flac -c -d "$file" | lame --alt-preset standard --ty "$tags[YEAR]" --ta "$tags[ARTIST]" --tc "$tag[COMMENT]" --tl "$tag[ALBUM]" --tt "$tag[TITLE]" --tg "$tag[GENRE]" --tn "$tag[TRACKNUM]" - "$outfile" # `flac -c -d "$file" | lame --alt-preset standard - "$outfile"`; # lame --ignore-tag-errors done