Tories announce $1.5-billion renewable energy plan. Which would have been nice if it hadn’t just been the old Liberal WPPI program (which the Tories cancelled) renamed, and claimed as a whole new thing. And there was highly qualified rejoicing.
In partial response to the Ask Metafilter question “How can I rename my music folders on my Mac based on ID3 tags?“:
#!/bin/bash # itunes_sanity.sh - fix dir names created by iTunes # only works for mp3s, and not actually tested on a Mac # created by scruss on Sun Sep 4 22:05:00 EDT 2005 find "$@" -type d -mindepth 1 | while read directory do artistdir=$(dirname "$directory") firstfile=$( find "$directory" -type f -iname '*.mp3' | head -n1 ) year=$( id3info "$firstfile" | egrep ' TYE ' | sed 's/=== TYE (Year): //; s/[^0-9]*//;' ) album=$( id3info "$firstfile" | egrep ' TAL ' | sed 's,=== TAL (Album/Movie/Show title): ,,;' ) echo mv \'$directory\' \'$artistdir/\[$year\] $album\' done
So if you were in the terminal, in your music library (one up from the individual artist directories), and you did:
itunes_sanity.sh Dan\ Jones Tripping\ Daisy
mv 'Dan Jones/Get Sounds Now' 'Dan Jones/ Get Sounds Now' mv 'Dan Jones/One Man Submarine' 'Dan Jones/ One Man Submarine' mv 'Tripping Daisy/Jesus Hits Like the Atom Bomb' 'Tripping Daisy/ Jesus Hits Like the Atom Bomb'
If that looks okay, run the output through the shell:
itunes_sanity.sh Dan\ Jones Tripping\ Daisy | sh
and all should be well.
You’ll need id3lib, which is probably most easily installed from Fink. Also, this only works for mp3 files; I can’t grok the tag info for AAC files. And finally, this might go seriously screwy on weird characters in filenames. You know my feelings on that …
How lucky that Thunderbird uses the same text mail format for storing messages. All I needed to do was scp individual server directories from under .thunderbird to ~/Library/Thunderbird/Profiles/saltname.default/Mail — that did the job!
I didn’t use the shared global inbox that Thunderbird uses by default. If you do what I did, you probably shouldn’t either.