Copy partially played Audiobooks to a playlist

May 15, '12 07:30:00AM

Contributed by: DougAdams

iTunes Smart Playlists don't offer a criteria to find tracks which have been partially played. While "Last Skipped" is an option, this track property may not be set if the track wasn't actually skipped and was merely stopped.

However, if a track's "Remember playback position" option is set (and most audiobooks have this set by default) the track's AppleScript bookmark property will contain the number of seconds that a track has advanced before being stopped. Thus, any track with a bookmark value greater than zero would have been partially played.

Here is an AppleScript that will copy all the tracks in the "Books" library to a new playlist named "Partially Played". Each time it is run it will update the "Partially Played" playlist.

property nameOfPlaylist : "Partially Played"

tell application "iTunes"
		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 (some playlist whose special kind is Books) whose bookmark > 0) to thePlaylist
	reveal thePlaylist
end tell
[kirkmc adds: Doug Adams originally posted the script here. You can read his post for a bit more info about how the script runs.]

Comments (0)

Mac OS X Hints