ACPI administration advocacy advocacy advocacy opinion alsa amarok apache apple apt aptitude archive audio audo authentication automount avi awk bash BIOS boot browser business cache calendar calibre cdr cdrecord censorship commandline computerscience console convert cron cut database date debian degree design desktop development disk dpkg dvd economics education emacs email europe exim faad ffmpeg file files firefox firewall flash foss freedom ftp fun fuse git gnumeric graphics grep growisofs grub gtkpod hardware hardware html icedove idiocy image imagemagick images installation ip iphone ipod iptables iso itunes ivman kde kernel keyboard knoppix lame laptop latex linux locale lockin locking longlines lsof m4a microsoft mimetypes minitab mount mp3 mp4 mplayer multimedia music mysql network nfs nfs4 nmap openbox openfiles openoffice opinion opinion orgmode partition pdf perl php podcast politics pomodoro ports postgresql printing privacy process programming rant remote rhythmbox rss rsync rxvt scp screengrab screenshot script scripting scsi security sed server services shell siteadmin sitenews sitesoftware skype skype slackware sound sox spam spreadsheet ssh statistics subversion sudo svk swap t23 t43 terminal tex text thinkpad thunderbird time timer timezone ubuntu udev upgrade usb usbmount users uuid versioncontrol vfat video vnc windows wine wordpress wordprocessing X40 xwindows xwindows youtube
Some media players can't play protected m4a's. This script converts the m4a passed on the command line to an mp3 that can then be copied to your selected media player:
#!/usr/bin/bash
#
# copy and convert
#
# Transcode m4a file to mp3
#
# This script is heavily based on the original here:
# http://www.minigeek.org/2007/07/linux-m4a-to-mp3-conversion-script
#
# Naturally, changes are licensed under the GPL
#
orig=$1
temp_wav=`tempfile --directory ~/tmp --suffix=".wav"`
mp3=`echo "$orig"|sed -e 's/\.m4a/\.mp3/'`
temp_trackinfo=`tempfile --directory ~/tmp --suffix=".txt"`
# deal with track info
faad -i ${orig} 2>$temp_trackinfo
sed -i '23s/unknown: /title: /' $temp_trackinfo
sed -i '24s/unknown: /artist: /' $temp_trackinfo
year=`grep 'date: ' $temp_trackinfo|sed -e 's/date: //'`
sed -i 's/unknown: iTunes/iTunes: iTunes/' $temp_trackinfo
genrecount=`grep -c 'genre: ' $temp_trackinfo`
unknowncount=`grep -c 'unknown: ' $temp_trackinfo`
if [ "$genrecount" -eq 1 ] && [ "$unknowncount" -eq 2 ]; then
sed -i '25s/unknown: /composer: /' $temp_trackinfo
sed -i '26s/unknown: /album: /' $temp_trackinfo
genre=`grep 'genre: ' $temp_trackinfo|sed -e 's/genre: //'`
fi
if [ "$genrecount" -eq 1 ] && [ "$unknowncount" -eq 1 ]; then
sed -i '25s/unknown: /album: /' $temp_trackinfo
genre=`grep 'genre: ' $temp_trackinfo|sed -e 's/genre: //'`
fi
if [ "$genrecount" -eq 0 ] && [ "$unknowncount" -eq 3 ]; then
sed -i '25s/unknown: /composer: /' $temp_trackinfo
sed -i '26s/unknown: /album: /' $temp_trackinfo
sed -i '27s/unknown: /genre: /' $temp_trackinfo
genre='other'
fi
if [ "$genrecount" -eq 0 ] && [ "$unknowncount" -eq 2 ]; then
sed -i '25s/unknown: /album: /' $temp_trackinfo
sed -i '26s/unknown: /genre: /' $temp_trackinfo
genre='other'
fi
title=`grep 'title: ' $temp_trackinfo|sed -e 's/title: //'`
artist=`grep 'artist: ' $temp_trackinfo|sed -e 's/artist: //'`
album=`grep 'album: ' $temp_trackinfo|sed -e 's/album: //'`
track=`grep 'track: ' $temp_trackinfo|sed -e 's/track: //'`
## convert to wav
faad -o $temp_wav $orig
## convert to mp3
lame --alt-preset 192 --id3v2-only --tt "$title" --ta "$artist" --tl "$album" --tg "$genre" --tn "$track" --ty "$year" "$temp_wav" "$mp3"
## clean-up
rm $temp_wav
rm $temp_trackinfo
exit 0
iTunes have a bit more options for tags than shown in this scripts.
I have made a similar script, with genre checking, albumartist, and playlist generation.
http://code.ecomerc.com/Articles/iTunesConvert/
Peter
Posted by Peter on 2012-03-12 13:33:36.