Wednesday, April 04, 2007

iTunes drag and drop bug: the Doug's AppleScripts workaround

iTunes OS X supports drag and drop export of a playlist to a folder. I use this to export AAC and MP3 (non-FairPlay) tunes to a thumb drive for play in the car or on my corporate laptop.

There's no other built-in method for exporting playlist files, and this method isn't documented. One reason it may be undocumented is that it's buggy. If a playlist contains two tunes of the same name (possibly same file name, I didn't have time to finish testing) the drag and drop aborts without an error message. It's a funny abort -- the files briefly appear then vanish.

Happily there appear to be workarounds. Doug's AppleScripts for iTunes, a site mostly built in 2005, has several scripts that sync or copy a playlist to an external folder. I'm going to try this one. Doug's site accepts Amazon donations (in addition to PayPal, a service I dislike for several reasons), so if the scripts work I'll send him a fiver.

PS. Doug's 'What's New' feed has some good tips and comments. He mentions a "tumblelog", a new categorical term which sounds like it might apply to this blog.

Update: Alas, the 'copy to folder' script has the same bug. I'll take a look at it and see if I can hack a fixed version that will do name collision fixes. I've written Doug in the hopes he might add this code.

Update 4/6/07: I haven't heard from Doug, so I decided to see if I could hack a workaround. I find AppleScript pretty painful to work with (anyone else notice Apple's online documentation is dated 1999?) but a relatively simple hack occurred to me; if I prefixed all the output filenames with an incrementing counter they'd be guaranteed to be unique. It took at least two hours to figure out how to do this (Ethan Wilde's AppleScript for Applications was by far the best reference I could find and it's very dated). Here's the modified script, my additions are in bold.
tell application "iTunes"
set counter to 0
set trackList to the selection of window 1 -- any window with a selection
set theTrackCount to count trackList
if ((count trackList) is 0) then
display dialog "No tracks are selected!" with icon caution buttons {"Cancel"} default button 1
return
end if
set theFolder to choose folder with prompt "Pick folder to copy the selected tracks to"

if theFolder is not "" then
repeat with theTrack in trackList
set counter to counter + 1
set theTrackName to ((the location of theTrack))
tell application "Finder"
try
set NewFile to duplicate file theTrackName to theFolder
set the name of NewFile to ((counter as string) & "_" & the name of NewFile)
if (counter mod 10 is 0) then display dialog "Processing track " & counter & " of " & theTrackCount giving up after 1 with icon note
on error
tell application "iTunes"
display dialog "The Finder reported an error: The file [" & (theTrackName as string) & "] could not be copied to [" & theFolder & "]. The counter is " & (counter as string) with icon caution
end tell
end try
end tell
end repeat
display dialog "Finished!" buttons {"Okay"} default button 1 with icon 1
end if
end tell

It takes a long time to run through a mere 179 tracks, but it works. The hardest part was figuring out how to get a handle on the result of the "Duplicate file" command; browsing the Finder's "Dictionary" I discovered the Duplicate command in 10.4.9 returns a reference to the output file. That wasn't documented anywhere else I looked.

This would have been a trivial task in the old days of DOS Batch programming, and it would have completed in a second or two. Progress can be elusive.

Tuesday, March 27, 2007

Beyond DRM: iPod, SONY car radio and cheap memory sticks

When I reviewed my new Sony Car FM/CD car stereo unit I wrote:
... I'm experimenting with leaving some old thumb drives or adapted CF cards in the car with specific excerpts from my music. I also now have 4 mixed AAC and MP3 CDs with music and podcasts arranged in folders -- for children, me, etc. Note a 2 GB thumb drive is usually under $30. Techbargain and similar sites often point to sales on these things. I'm looking for a short usb extension cords with a right angle turn ...
The experiment has been a great success with a $30 2GB SD card and reader ($15 if the rebate really pays off). I haven't been able to locate a 6" USB cable with a right angle connector, but the standard 6" cable is working well.

The stereo plays AAC very well, and iTunes is a great staging platform for both burning AAC/MP3 CDs and transferring multiple playlists to the 2GB reader/card combo. The one restriction, of course, is that DRM doesn't play in this world -- I'm now buying CDs to replace the 10 or so fairPlay DRMd tunes I want to keep.

The next step is to start taking the SD card from the car into my office. I stick it in the laptop, configure iTunes to reference the tunes in place rather than import them, and drag and drop the folders into iTunes. In less than a minute the entire Library is created [1]. I connect my headphones and play from the laptop.

So, where does this leave our three iPods? Hmm. I bought a new car stereo primarily for use with my 4G iPod, but now I find I don't bother with it in the car. The AAC/MP3 CDs and memory stick are far more rugged and I don't care if they're lost, stolen, or broken.

iTunes remains invaluable [2], but our Shuffle is now less useful. I wouldn't buy a Shuffle again, I'd spend the money on an SD card that I can use for music or in my camera. The Nano is still great for exercise and general portable play. The full-sized iPod is not suited to exercise but it plays videos [3] and I'm still very fond of it for travel.

The SONY car radio is having a very interesting effect. I suspect I'm not the only one that will notice this. People don't replace their car stereos all that often, so this will take a while to percolate, but the writing is on the wall. DRM is clearly doomed for music, but I think video DRM has a few years of life left [4]. Ultra-cheap solid state storage devices are going to have lots of interesting effects [5]. Apple might as well give up on the Shuffle (stupid cradle) now, or make as a mobile storage device with iTune [5]. The Nano has some legs I think, but the Apple phone better work. I know I hope it will!

Footnotes

[1] The sound quality is not as good as my iPods -- they have a better D/A converter than the Dell laptop I have at work. When I redo the SD drive I have to wipe the Library to avoid 'missing tunes', but that takes only a moment. I could import the tunes, but they use up a lot of space and it's tricky to avoid wasting space on the corporate backup server.

[2] There's nothing to stop Microsoft from licensing AAC and providing a competitive alternative on the Dell laptop; Apple doesn't own AAC and there's no fee for playback use with AAC. If the Zune continues to flounder I think they'll cave.

[3] More on why, surprisingly, we've actually found a use for video on the iPod, and why we may end up willingly buying DRMd video/tv via the Apple store even as we've abandoned Apple store music.

[4] Apple better start thinking about a video-FairPlay solution for vans though!

[5] iTunes could begin to support named external media to make the workflow smoother for removable music storage devices.

Monday, March 26, 2007

The OS X Image Capture/iPhoto EXIF orientation tag bug bites Apple TV

Some photos may not be rotated correctly when viewed on Apple TV is an old bug with EXIF orientation tags in Image Capture and/or iPhoto. I don't think Apple every acknowledged they'd messed up the EXIF tags for thousands of photos across thousands of customers (eg. millions of corrupted EXIF tags).

Apple should provide a utility to repair the damage.

Thursday, March 22, 2007

Primary Keys: IDs versus GUIDs

I need to get a life. This actually made sense to me:
Coding Horror: Primary Keys: IDs versus GUIDs

...You can generate IDs anywhere, instead of having to roundtrip to the database...
The article, comments, and links are a good mini-tutorial on a relatively esoteric aspects of managing data -- how should one generate a unique identifier? This one advantage solves a problem for my work life ...

A use for my Apple remote

Sometimes the kids don't want to turn off the MacBook when their time is up. Now I can zap it from across the room ...
Stupid Apple Remote Tricks | Macinstruct

...Simply hold down the Play/Pause button and your Mac will go to sleep. To wake up your Mac, press any button on the remote...
Our Mac screens lock when they sleep, so this is a sleep and lock function for us.

(found via TUAW)

My singular war with Adobe Acrobat Update Manager

[9/25/08: skip to the end for Adobe's recommendation for OS X users]

For years I've had trouble with Adobe Acrobat Update Manager. I think it's something to do with the version Adobe distributes for large enterprises. The updates don't work, and I get messages with words like these:
"Adobe Acrobat Update Manager" "resuming a download" "file on the server" has changed
Every month or two I try a Google search looking for a fix, but I never find anything. I'm the only person in the world hit by this bug.

If you find this post when searching, you're probably in the same club. Send me a note and maybe we can figure this one out...

Update: apparently all I had to do fix this was blog about. Today I got the usual update manager dialog, but this time it actually downloaded a fragment of a file before it quit. The file was broken, but the file name was visible:
Ac705PrP_efgj.exe
A Google search on that pointed to an Adobe download link. The download went very, very slowly, but the file was intact. I was able to then update Acrobat Pro to 7.05. After restarting Adobe Update Manager tried AGAIN to do the update to 7.0.5, but this time it downloaded the file where I told it to and it did the install (nothing was changed since I was now at 7.0.5). So it's working -- for the first time in ages. So now I'll see what happens.

Update 11/26/07: This Adobe download link provides one with all the 7 series updates. A few related tips uncovered in this latest version of the adobe wars:
  • be sure that you choose to retain the "installer files". If you don't, life will be heck. During the initial install there's an option to delete these. Don't.
  • If you try to be careful, and you don't install Adobe's troubling plug-ins, you also don't install the default Adobe PDF printer! I chose to install the plug-in for Office and it's probably not a bad idea to install the Visio plug-in too. I avoide all Outlook 2003 plug-ins because I think Outlook 2003's add-in (plug-in) architecture is very unstable.
  • Be very careful not to install Adobe's automatic updater. It's pure evil.
  • Adobe 7.0.5 was the only cumulative updater. So a fresh Acrobat install of 7.0 Professional is very painful requiring multiple updates and reboots.
There's a good reason I don't let Adobe on my OS X machines -- neither reader nor Acrobat.

Update 9/25/08: Incredibly Adobe Updater still has the same problem, but a helpful reader did get a pretty quick answer from Adobe:
I found your page when searching for the same problem you had with your Adobe Updater (...file on the server has changed). I didn't see a solution so I ended up contacting Adobe and they responded in 4 hours with this:

The following steps will clear the Update Manager preferences so that the utility will recheck what updates have been installed:

1) Close all applications.
2) From the Finder select Go > Home.
3) Browse into ~/Library/Application Support/Adobe
4) Move the folder named Updater5 to the Trash.
To launch the Update Manager manually:
/Applications/Utilities/Adobe Utilities/Adobe Updater5/Adobe Updater.app

Wednesday, March 21, 2007

My personal spam blacklist: Gourmet, SONY, Canon and more

One of the more recent developments in the war on spam is the rise of spam from legitimate companies with real email addresses. These include companies I've previously liked (Canon) as well as real companies I've never done business with.

The good news is that, for this group and for political organizations, Blacklists work great. You block their addresses, and they don't bother you any more.

This is my personal Blacklist as of today. Canon is the newest addition. To get on here a legitimate company or political organization has to keep sending me spam despite my clicking a remove-me link. If a persistently spamming corporation doesn't have a one click remove-me solution they go right to the list.
antec.com
buy.com
canonmarketing@cits.canon.com
condenast.us
dailyupdates.org
emaillabs.com
gourmet.com
itw.itworld.com
mail.sonymediasoftware.com
mail.united.com
newsroom@elsevier.com
peakperformancellc.com
theclubbingforum.net (no, I have never been a customer)
travelmole.net
I'll update this post as I add more brick and mortar corporations with serious spam problems. Of this list I was most impressed with Gourmet.com -- they were relentless spammers. SONY media was almost as bad -- heck, come to think of it, they were all really bad. Canon went to the Dark Side about two months ago.