I am having the same problem with the faad2 output. it would be nice if they'd numbered their 'unknown:'s so u could actually use them in a script, otherwise u get all the unknown fields. Any solutions greatly appreciated! I don't regret the move to Linux for me, just wish i could have all my music the way i had it...
If anyone has any ideas on how to solve this one, it would be very useful. perhaps i could write a script which uses the first occurence of unknown for title, the second for artist, etc. assuming you know where the information appears in the .txt dump (which i do for all my files) then this would work. any ideas??
-edit
right, had a productive night and here is a script for music off an iPod, with unknown fields, maybe composer and an unknown genre. this assumes that faad2 gives u a txt output in the following order, where (u) is unknown: title(u), artist(u), composer(sometimes)(u), album(u), genre(maybe u), track, year(u), compilation, tempo, itunes(u), i TunNorm.
right, here goes...
#!/bin/bash
#
# m4a to wav
# for music from iPod
for i in *.m4a
do
faad "$i"
x=`echo "$i"|sed -e 's/.m4a/.wav/'`
y=`echo "$i"|sed -e 's/.m4a/.mp3/'`
faad -i "$i" 2>.trackinfo.txt
sed -i '23s/unknown: /title: /' .trackinfo.txt
sed -i '24s/unknown: /artist: /' .trackinfo.txt
year=` grep '^unknown:[[:space:]]*[[:digit:]]*[[:space:]]*$' .trackinfo.txt|sed -e 's/unknown: //'`
sed -i 's/^unknown:[[:space:]]*[[:digit:]]*[[:space:]]*$/year: /' .trackinfo.txt
sed -i 's/unknown: iTunes/iTunes: iTunes/' .trackinfo.txt
genrecount=`grep -c 'genre: ' .trackinfo.txt`
unknowncount=`grep -c 'unknown: ' .trackinfo.txt`
if [ "$genrecount" -eq 1 ] && [ "$unknowncount" -eq 2 ]; then
sed -i '25s/unknown: /composer: /' .trackinfo.txt
sed -i '26s/unknown: /album: /' .trackinfo.txt
genre=`grep 'genre: ' .trackinfo.txt|sed -e 's/genre: //'`
fi
if [ "$genrecount" -eq 1 ] && [ "$unknowncount" -eq 1 ]; then
sed -i '25s/unknown: /album: /' .trackinfo.txt
genre=`grep 'genre: ' .trackinfo.txt|sed -e 's/genre: //'`
fi
if [ "$genrecount" -eq 0 ] && [ "$unknowncount" -eq 3 ]; then
sed -i '25s/unknown: /composer: /' .trackinfo.txt
sed -i '26s/unknown: /album: /' .trackinfo.txt
sed -i '27s/unknown: /genre: /' .trackinfo.txt
genre='other'
fi
if [ "$genrecount" -eq 0 ] && [ "$unknowncount" -eq 2 ]; then
sed -i '25s/unknown: /album: /' .trackinfo.txt
sed -i '26s/unknown: /genre: /' .trackinfo.txt
genre='other'
fi
title=`grep 'title: ' .trackinfo.txt|sed -e 's/title: //'`
artist=`grep 'artist: ' .trackinfo.txt|sed -e 's/artist: //'`
album=`grep 'album: ' .trackinfo.txt|sed -e 's/album: //'`
track=`grep 'track: ' .trackinfo.txt|sed -e 's/track: //'`
lame --alt-preset 128 --tt "$title" --ta "$artist" --tl "$album" --tg "$genre" --tn "$track" --ty "$year" "$x" "$y"
rm .trackinfo.txt
rm "$x"
mv "$y" "$artist - $title.mp3"
rm "$i"
done
hope it works Tony_cas, if u havent already solved it. worked for me
note: removes the original m4a and renames the mp3 to "artist - title" though this is easily changed to preference.
oh, and should say that this is based on the original script posted by d-rockbrinks
MMatt