#!/bin/sh
# expecting to be called as ' yammiMp3Edit "%f" "%F" %b "%a" "%t" "%u" ' from yammi as plugin
# note that this plugin overwrites your original file after editing...
# 2002, Tom Roth (tom@tomroth.de)
mpg123 -w "/tmp/$2.wav" "$1"  || exit 1
echo "passing $1.wav to snd"
snd "/tmp/$2.wav"
# echo "1 $1 2 $2 3 $3 4 $4 5 $5 6 $6"
echo "encoding  $1.wav to $1"
#bitrate seems not to be reliably  so i am not using it
#notlame --tt "$5" --ta "$4" --tl "$6" -h -p -t -b $3 "/tmp/$2.wav" /tmp/$2  || exit 1
notlame --tt "$5" --ta "$4" --tl "$6" -h -p -t -b 192 "/tmp/$2.wav" "/tmp/$2"  || exit 1
# when you use a mp3encoder that does not support id3tagging you could use id3ed
#echo "id3 tagging"
#id3ed -s $4 -n $3 -a $5
echo "copy /tmp/$2 to $1"
cp "/tmp/$2" "$1"  || exit 1
# everything should be fine now
echo "cleaning up"
rm  "/tmp/$2.wav" "/tmp/$2"
