Friday, October 3, 2014
So it's been a couple of years, eh?
Since I last posted, I left Chicago and my postdoc position at Northwestern, moved back to Canada to lend some neuroimaging programming help to the good folks over at the Brain and Mind Institute at my alma mater, UWO. Some other stuff happened in the background, primarily aimed at securing a non-contract job so that we could afford to raise baby Roman, who was born during this time. This lead to me finally landing a tenure track job in the Psychology Department at the University at Buffalo.
I finally arrived!
With a new job comes new computer equipment. Despite not being a Mac fanboy, pretty much all of my equipment consists of Mac computers. So I've doubled-down on the Apple ecosystem, it appears, though this ironically was out of a preference for Linux: I figured Apple Intel hardware would be able to run *any* of Windows, OS X or Linux, if I so desired. My other option, Dell, would be limited to Windows or Linux. Options, baby.
But that's not what I wanted to write about. No, this is another programming PSA. Now that I've got that iTunes bloatware as my primary media dispenser, I've got a new set of problems. In particular, I like to use a song's play count as an index of how much I like the song: the most played song in my library is probably one of my favourite songs, and a playlist of the most played songs are the ones that I would probably most want to include on my iPhone. The problem: When you first set up iTunes, the play counts for all songs are 0, and it will take some while (and likely some concerted effort) for those play counts to start to be useful for differentiating your most and least favourite songs.
Fortunately, I am also a meticulous user of meta-tags for my music. In particular, I try to make sure that my songs are rated. So I wrote a script to calculate a fake initial play count based on the ratings I gave a song in iTunes. In a nutshell, it calculates a base play count, where 0 stars = 0, 1 star = 10, ... , 5 stars = 50. Then it adds a random number from 1 to 8, just to keep things lively. Finally, it takes the average of this fake play count and whatever the current play count is, and uses that for the new play count.
I'll paste the script code below. To use, copy/paste it to a new text file and save it with some sort of informative name, like RatingToPlayCount.app (you may have to rename the file manually if a different file extension gets added). Place it in your iTunes scripts directory. Open iTunes and you should see your script name in the menu bar. Select any or all tracks and run the script. Moments later you should find all your play counts updated to new values. I assume this only works on OS X platforms, and not for people running iTunes for Windows.
-- Start cut here