Sunday, May 20, 2012

Finding partly played podcasts: In Our Time

iTunes tracks how many times tracks have been completely played [2], but it doesn't provide any UI for tracks that have been partly played.

This isn't a big deal for music or videos, but it's a real bother for podcasts. I have 72 episodes of "In Our Time" in my "IOT unplayed" shortlist; and I know some of them are partly played. I just don't know which ones. 

It's been a longstanding frustration, but this week, Doug's AppleScript for iTunes gave me the answer:

Project: Gather Partially Played Tracks « Doug's AppleScripts for iTunes

... Smart Playlists don’t include any criteria for detecting how far along a track has been played, and Last Skipped may not necessarily have been set if a track was simply stopped rather than skipped.

... a track’s bookmark property will contain the number of seconds the track had been played before it was stopped. Thus, if any tracks have a bookmark value greater than zero then they’ve been partially played...

I'm lousy at AppleScript, but it wasn't hard to modify the example Doug provided. I have a smart Playlist called "IOT Unplayed" and I modified the AppleScript to find tracks in that Playlist that had a bookmark value greater than zero [3]:

property nameOfPlaylist : "Partially Played"

tell application "iTunes"
set opt to button returned of (display dialog ¬
"Find partially played tracks in:" buttons ¬
{"Cancel", "Podcasts", "IOT Unplayed"} default button 3)

if opt is "Podcast" then
set targetLibrary to (some playlist whose special kind is Podcasts)
if opt is "IOT Unplayed" then
set targetLibrary to some playlist whose name is "IOT Unplayed"
set targetLibrary to library playlist 1
end if
end if

set thePlaylist to some playlist whose name is nameOfPlaylist
on error
set thePlaylist to (make playlist with properties {name:nameOfPlaylist})
end try

delete every track of thePlaylist
end try

duplicate (every track of targetLibrary whose bookmark > 0) to thePlaylist
reveal thePlaylist
end tell 

Of course this isn't as elegant as a Smart Playlist -- I need to run this AppleScript manually. Even so, it solves 80% of my pain. Thanks Doug!

[1] I donated $5. It was a royal PITA to do so. It reminded me of how bad our donation system is. Among other things:

  • I distrust PayPal intensely based on past experience. So I had to use the awkward data entry UI.
  • It took me a while to figure out I had to 'update amount' - so that cost me two data entry episodes
  • I had to go back and add an email
  • If I could keep track of how much I'd previously donated to the site, I might make a larger (or smaller) donation.


[2] I have a feeling that years ago iTunes would consider a track "played" if one simply started listening to it. I'm probably wrong about that.

[3] In my hacked AppleScript the 'library playlist 1' statement will never be reached; I just kept it in as a reminder of how to scan all tracks. AppleScript only allows 3 buttons, otherwise I'd have made this an option.

1 comment:

Martin said...

That's why I use an iOS podcatcher … :)