view by post / day / month

next to godliness 1/28/2010
completism 1/27/2010
snap crackle & bop 1/26/2010
a conflict of allegiances 1/25/2010
turn it off, man, turn it off 1/22/2010
here comes the rain again 1/20/2010
in from the cold 1/19/2010

previous next
completism 4:19pm 1/27/2010  

While my quest for the über-tracker application for iTunes has gone from open source applications like Audioscrobbler to a home grown Visual Basic program called iTunesLog to currently an Applescript application entitled iTunesEvents, one thing i (and others) have continuously struggled with is keeping track of what's played on an iPod. My logging strategy on my main computer focuses on monitoring iTunes and sending play entries to a MySQL database whenever enough of a track is played (usually 50%). The whole reason this is necessary is because iTunes does not keep a complete log of what has been played. It only keeps track of when the last time each track was played, and the total number of times it has been played. Therefore you can generate a "smart playlist" of recently played tracks, but if you played Deerhunter's "Nothing Ever Happened" 20 times, it will only show up once in that playlist. And if you want to ask obtuse questions like "what song did i listen to most in March, 2007?", iTunes can't help you because there is no complete play history. That's why i endeavored to link my play history to a complete MySQL database using a custom-made program.

Enter the iPod problem. Currently i have both my 160GB iPod classic as well as my 8GB iPhone, and i listen to music on each when away from my Mac Pro at work. Each are frequently synched with my main Mac Pro iTunes library. The problem begins with the fact that there is no way to run an application on an iPod that will monitor play habits in real time and send them to a remote database. This may be possible with an iPhone, as it has a network connection and the ability to run custom software, but as yet i haven't undertaken that challenge. Therefore in order to extract an iPod's play history you need to do it at the time it is synched with the main computer. iTunesLog used compare the play dates on an iPod with the main iTunes library whenever an iPod was connected, and would generate a text file of play entries that i could add to my database. However this was in the days when i manually managed my iPod's content. Since becoming a convert to smart playlists, i've had to switch off "manual management", which prevents a program from querying tracks on an iPod. Moreover, my iPods sync immediately on being plugged in, which basically equalizes the play dates between the iPod and iTunes so that this comparison is rendered meaningless.

I'm not the only one who has struggled with this ... Audioscrobbler and both provide logging tools, but both discuss the issue of getting an iPod play history at length on their support pages and forums. However yesterday i coded what i think is perhaps the best possible solution given iTunes inner workings. My solution doesn't do anything specifically with iPods or iPhones, what it does is compare the iTunes play history with that in the MySQL database. It's a one way comparison ... it basically goes through all the tracks played in iTunes and looks in the database to see if there is an entry with the same (or almost the same) play date. If so, on to the next. If not, then it adds it to the database. This strategy therefore finds tracks that for one reason or another didn't make it into the database, and adds them. This would include tracks played on an iPod or iPhone that has been synched with the iTunes library, or alternately tracks that were played when the MySQL database was down or when the log application wasn't running. It doesn't solve all possible problems ... for example, if my Deerhunter mania continued and i played "Never Stops" all weekend long on my iPod, it would only get added once to the database on the next execution. However, as near as i can tell this is the best solution i'm going to find. I ran it earlier today and found that over the last few years at least 15% of the songs i've played haven't made it into my database. Most certainly more than that, due to the problem mentioned above. However they're in there now. Here's to OCD.

last edited 4:19pm 1/27/2010 back to top


login to submit comments

previous next