Mar 03
Permalink

PodWorks 2.9.3

Around the end of last year, I decided that I needed to take a brief detour on the road to PodWorks 3.0 and put out PodWorks 2.9.3, a free update aimed at tackling a few problems I believed were causing the majority of legitimate PodWorks support issues. As I dug into said problems, though, I began to realize that really solving them was going to require more fundamental and far reaching changes than I was initially expecting. Furthermore, as I really got into the groove of fixing stuff, I kept thinking of more and more things I wanted to fix if this was really going to be the last update before 3.0, which, in turn, caused the project to go on even longer.

Fortunately, after months of hard work, I’ve finally got a release that I’m very proud of. Nearly every part of the code has been improved to some extent, and I think this release really nicely completes the “PodWorks modernization project” I started with PodWorks 2.9. Here’s what you can expect when I release it tomorrow.

AppleScript Improvements

Most of the support emails I get are about problems that are, at their root, AppleScript-related. PodWorks contains an AppleScript, you see, which it uses to transfer songs, playlists, and metadata into iTunes (Apple has yet to provide third party developers with an “iTunes API” or other more effective way of dealing with iTunes). Unfortunately, AppleScript isn’t famous for it’s reliability in even the best cases, and iTunes’ AppleScript implementation is far from the best. In fact, it’s quite fragile and capricious, prone to throwing strange and unpredictable fits, and even to going on strike entirely under some conditions (such as when the iTunes preferences window is open).

In order to better deal with such inconsistencies, I rewrote PodWorks’ AppleScript code almost completely for this release, taking into account some wisdom from Daniel Jalkut and others. PodWorks now tries to determine whether or not iTunes is responsive before attempting a transfer, and alerts the user with an error dialog if it isn’t. Also, because iTunes frequently produces seemingly random errors that disappear upon subsequent transfer attempts, PodWorks now tries every individual song transfer three times before giving up on it and moving on.

New “Transfer Errors” Window

Another common complaint about previous versions of PodWorks was that a single AppleScript error could bring the entire transfer process to a halt. I decided that a good solution to this problem was to implement a sort of transfer error console, which could display all of the errors accumulated during the course of a transfer instead of showing them one by one as separate error dialogs.

I also thought it would also be a good idea to allow the user to attempt a re-transfer of all or some of the song for which the errors occurred. The list of errors in the window persists until the user detaches the iPod, switches the active iPod, or does another transfer, which means the user is free to attempt a retransfer at his or her leisure.

“Show Only Songs Not in iTunes”/Duplicate Prevention Improvements

PodWorks has a number of features that require it to match songs on the iPod to their counterparts in iTunes: “Show Only Songs Not in iTunes,” duplicate prevention, and (new in this release) metadata-only transfers.

Traditionally, PodWorks has determined that a given track on the iPod is the same song as a track in iTunes by searching through the iTunes library for a track with a matching title/artist/album combination. Unfortunately, while I implemented this search using an efficient algorithm, the process was still slow-ish and could occasionally be inaccurate.

In this release I have improved both the performance and accuracy of the song matching process: the former by ensuring that PodWorks only re-reads the iTunes library (as expressed in the “iTunes Music Library.xml” file) when necessary (as determined by the file system modified date), the latter by simply fixing some bugs in the algorithm.

Recent iTunes history has also seen the introduction of a useful new concept in the iPod database—iTunes persistent IDs—and PodWorks 2.9.3 also takes advantage of this development to provide more efficient and accurate matching of songs under certain conditions.

The database entry for each track on the iPod has a persistent ID number, you see, and that ID will match the ID of a song track in the iPod’s “home” iTunes library. Thanks to this correspondence, PodWorks can do more efficient and bulletproof matching of songs between the iPod and iTunes, assuming the iTunes library it is matching against was the one from which it was synced. In the case where the iPod was synced from a different library, PodWorks can still fall back on its traditional title/artist/album matching technique. The “iTunes” tab in PodWorks’ Preferences window now also gives the user some control over the matching technique used (persistent ID matching with a fallback on title/artist/album search, persistent ID only, and title/artist/album search only).

As I mentioned above, PodWorks also has a new feature that benefits from all of these song matching improvements: metadata-only transfer. Eventually I may do a more prominent UI for this feature, but right now it is essentially implemented as a new option for how PodWorks handles duplicate prevention during transfers. If the appropriate Preferences checkbox is checked, and PodWorks determines (using the aforementioned matching methods) that a given song being transferred is already present in iTunes, it will simply modify the metadata (title, artist, album, comments, composer, genre, year, last played date, disc number, total discs, track number, total tracks, play count, star rating) for the track in iTunes so that it matches the metadata for the track on the iPod.

Other Assorted Changes

It’s actually kind of difficult to list all of the changes I made during the course of this release, but a few others include:

  • Modernized low level file copy code by removing deprecated API.
  • Made track sort order match iTunes more closely.
  • Added “last played date” to the set of metadata PodWorks can copy along with songs.

PodWorks 2.9.3 is a free update for registered users, so sit back and enjoy the fruits of my last few months’ labors. And just you wait for 3.0!