Skip to content

Instantly share code, notes, and snippets.

@talios
Created August 2, 2011 02:29
Show Gist options
  • Select an option

  • Save talios/1119473 to your computer and use it in GitHub Desktop.

Select an option

Save talios/1119473 to your computer and use it in GitHub Desktop.
F-Script based iTunes playlist sort hack
df := NSDateFormatter new.
df setDateFormat: 'yyyy-MM'.
iTunes := SBApplication applicationWithBundleIdentifier:'com.apple.iTunes'.
playlists := (iTunes sources at: 0) playlists.
playlist := (playlists where: playlists name = 'The Full Daily Play') top.
playlist tracks do: [:track |
skipDate := (NSDate dateWithString: (df stringFromDate: track dateAdded) ++ '-01 00:00:00 +1200').
group := (df stringFromDate: track skippedDate).
(skipDate isEqualToDate: track skippedDate) ifFalse: [ track setSkippedDate: skipDate].
(group isEqualToString: track grouping) ifFalse: [ track setGrouping: group].
].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment