Archive for the
‘iTunes Match’ Category
So there’s this problem with iTunes Match whereby a downloaded file is unable to be played all the way through. My friend Kirk McElhearn describes the problem in great detail here. Essentially, the iTunes Match file is downloaded but some kind of corruption in the file prevents audio data from being read/played all the way through to the end even though all the data is very likely extant. If a truncated track and associated file are deleted it can be re-downloaded intact successfully. But it is difficult to hunt these tracks down since the reported duration, start, finish, size and time values of the tracks are correct and there is otherwise nothing detectably unusual about them.
The only way to discover if a track is truncated is to play it and hear it end abruptly. Since it appears that less than half the audio data of these tracks is playable, I found that by starting to play the track after positioning the cursor very close to the end of the track in the iTunes LED window the next track would play immediately if the clicked-on track was truncated.
So I’ve written a script, Find Truncated Tracks, that automates this process for a playlist of tracks and copies the varmints to a discrete playlist for later recycling. Find Truncated Tracks will go through the tracks in the current playlist starting with a single selected track. It will position the play head at ten seconds from the end of the track. Then, it will play the track and immediately check the player position. If the track is truncated, the player position will be the last playable second of the track which will be much sooner than the ten-seconds-from-the-end play position at which the track was just set to start. Thus detected, this truncated track will be copied to a new playlist named “_Truncated Tracks”. And so on for each track in the playlist from the selected starting track.
Unfortunately, it’s not terrifically fast. Each track must be played in real time so that the script can detect if it can play all the way through. Fortunately, a track only needs to play for a fraction of a second to get its current player position. But still, the script’s not going to finish up instantaneously. Average running times at my house were about three minutes per thousand tracks.
Play counts are not affected.
You may run into a dialog that will popup for unauthorized purchased tracks (if you have any of those). AppleScript can’t prevent this, so that may put the kibosh on unattended use. Otherwise, just let it run and go out for a sandwich.
If you are using iTunes Match to update your music to the higher-quality Store stuff you may run into a duplicate file problem if you don’t Trash the original files first. For example, I’ve got an album of MP3s I ripped in 2002 at 128K and now want the 256K AACs that I can download with iTunes Match. The trick here (explained by Macworld’s Jason Snell) is to delete the tracks and Trash the files from iTunes, but not from the cloud. Then I can click the tracks’ cloud icon to download the new files from the Store. However, if I don’t Trash the files they will remain in my iTunes Media folder heirarchy and when the new AACs are downloaded I’ll have the original MP3s alongside the new AACs.
But, if you get yourself into this situation you can easily find and remove the files that are no longer in your iTunes library (but which are still in your iTunes Media folder) with Music Folder Files Not Added. This app will list the files in your designated iTunes Media folder which are not in your current iTunes library so that you can Trash them (or add them, if you like).
iTunes 10.5.2 appears to fix some issues I was seeing regarding AppleScripting and iTunes Match. In 10.5.1, AppleScript occasionally wouldn’t recognize that a track had “morphed” from shared track to file tracksay, after downloading a file from the cloudand visa versa without restarting iTunes. This is fixed and AppleScript detects the change of class immediately.
Also, attempting to delete an iTunes Match file track from the library will no longer elicit the alert dialog requiring confirmation to remove the track from the cloud; the track will simply remain in the library as a shared track and will remain in the cloud. Its file remains in its original location (although its local file path can be retrieved via the track’s location property and used to move, Trash or rm the file if necessary). For obvious security reasons, AppleScript cannot delete a track from the cloud or completely delete an iTunes Match track from iTunes. This kind of removal can only be done manually by the user.
I should note that a script probably should remove the file when deleting an iTunes Match track from the library (that is, library playlist 1; deleting from an ordinary user playlist simply removes the track from the playlist, as expected). Otherwise, re-downloading the file from the cloud will create a duplicate file.
On another note entirely, I’m seeing artwork now appearing again as a track’s file’s Finder icon. Since iTunes 10.4 artwork behavior has beenas one tweet to me put it”hinky” in this regard. I don’t pay much attention to artwork so this may have been fixed in 10.5.1 or perhaps is an iTunes Match phenomenon.
More as it develops.
(UPDATE: Several Correspondents have reported that artworks were showing up as Finder icons again as of 10.5.1.)
I’ve been hearing of an iTunes Match glitch that somehow or another creates thousands of empty playlists. Here’s a script that will delete every empty playlist:
tell application “iTunes”
set y to (get index of last user playlist)
repeat with i from y to 1 by -1
set thisPlaylist to user playlist i
if special kind of thisPlaylist is none then
if not (exists track 1 of thisPlaylist) then
It may time-out because the number of actions it has to perform is so large. Just run it until the empties are gone.
I have received a handful of disparate reports regarding issues running iTunes Library Manager with iTunes 10.5.1. In short, iTLM will not display backed-up libraries correctly and in one scenario crashes when attempting to Save or Load.
I am currently investigating these issues, no doubt precipitated by changes in iTunes 10.5.1 file management. Under the circumstance, I cannot recommend using iTunes Library Manager if you also intend on using iTunes Match.
Cloud-stored tracks that have not been downloaded to iTunes are seen by AppleScript as class shared track until they are downloaded at which point they morph into class file track. This is similar to how an un-downloaded podcast episode morphs from URL track to file track after downloading it. (I have also occasionally experienced a phenomenon whereby, after downloading a cloud track, AppleScript still treats it as a shared track until I restart iTunes. Not sure why that’s happening.) A shared track inherits properties from track and does not have a location (file path) property as does file track. Typically, a shared track is the class of track listed in Home Sharing libraries (or old-style shared libraries).
For the most part, the track properties of a cloud track can be manipulated with AppleScript. This is different from how a Home Shared shared track works, the tags and such of which cannot be changed with AppleScript. Presumably, you are the “owner” of cloud tracks and have permission to edit the tags but you are not the owner of Home Shared tracks since they are on a different machine. My understanding is that changes made to a cloud track’s tags locally are not automatically updated on other devices on which they appear. A track on another device would need to be deleted and re-downloaded in order for changes to be seen. [Update: I misspoke. Some data, like played counts and ratings, apparently travel to the cloud automatically.]
Macworld’s Jason Snell describes in this article how to upgrade tracks with iTunes Match to 256kbps AACs. iTunes Match will allow you to re-download these types of files even if the matched tracks are lesser quality. To gather these lesser-quality matched-tracks together, Jason describes how to create a Smart Playlist with the correct criteria. I’ve created that Smart Playlist and exported it and have included it in a script which, when run, will add that Smart Playlist to your iTunes for you. Here is the direct download link. Just download and double-click the script; make sure iTunes is running. Be sure to read Jason’s article to understand the rest of the details.