I got an old iPhone to replace my lost iPod nano. I traded homebrew for it! Little did I know that iPhones can’t shuffle by album, which is my preferred way to listen to music. So, I decided to finally write this dumb little Perl script to make one giant playlist that only contains whole albums, sorted roughly in order of least recently played, with albums of higher rating moving up to the top more quickly. You need the Mac::iTunes::Library module from CPAN. The script actually writes out an AppleScript that you can put into a file and run, or pipe to osascript, or just stare at confusedly.
There is also a script to locate likely compilations that don’t have the compilation flag or album artist set, which confuses the scoring and scatters a compilation’s tracks all over the place.
The “mixes” part is very specific to my library, but it won’t hurt anything.
Anyway, here it is on github.