iTunes Mass Importer
Bauhaus - King Volcano
![](http://musicbrowser.xrayspx.com/thumbs/fdd699597093a8eb8860d21f5c1d6312.png)
For my own notes, so I don't forget I did this... Big thanks to Doug from Doug's Applescripts for iTunes for convincing me that making iTunes update in this way is possible.
As with all things, I have to make my music library overly complicated. In historical times, I ripped at 128k, then 192k, but even a lot of the 192k mp3s sound like crap, so I've decided that going forward, I'm doing 320k CBR MP3s as well as FLAC.
I'm using Max to do the rip and encode on the Mac. It encodes both sets of files in parallel and saves them in a directory under ~/Music/max-rips/Artist/Title.
Here is a script to sort that and update iTunes. It'll drop the MP3s in my MP3 library directory, then drop the FLACs in a repository for them, finally making iTunes add the new files at the end. If all you want is to make iTunes rescan your library for new files from a script of bash shell, you want the osascript line toward the bottom, just substitute the path to your collection in place of mine.
I'd like to pass $directory and $albumdir to the osascript and have it live inside the inner for loop, but I've not figured out how to use my variables inside the 's that osascript -e requires to run its part. It only takes a few seconds to re-index the whole thing.
This is the utterly fugly 15-minute first draft with crappy variables and whatnot, but it does work.
(Yeah yeah, "find blah blah | while yadda yadda", 15 minutes, works, admittedly fugly, 2000 CDs and nothing has | in the artist or title)
Update #2: Nevermind all that, the script below is a lot clearer and does all that stuff I wanted.
maxmover.sh:
#! /bin/bash
find ./max-rips -depth 1 -type d | awk -F "max-rips/" '{print $2}' | while read artist
do
mkdir "/Volumes/Filestore/CDs/$artist"
mkdir "flac-output/$artist"
find "./max-rips/$artist" -depth 1 -type d | awk -F "max-rips/$artist/" '{print $2}' | while read album
do
mkdir "/Volumes/Filestore/CDs/$artist/$album"
mv "max-rips/$artist/$album"/*.mp3 "/Volumes/Filestore/CDs/$artist/$album/"
mv "max-rips/$artist/$album" "flac-output/$artist"
`/usr/bin/osascript
tell app "iTunes"
add POSIX file "/Volumes/Filestore/CDs/$artist/$album/"
end tell
EOT`
done
rm -f "max-rips/$artist"/.DS_Store
rmdir "max-rips/$artist"
done
Update:
It looks like there are several ways to skin my osascript cat. These aren't even the most fluid examples I've found.
- xrayspx's blog
- Log in to post comments
- 4840 reads