Skip to content

Instantly share code, notes, and snippets.

@seandenigris
Created April 26, 2011 17:14
Show Gist options
  • Save seandenigris/942676 to your computer and use it in GitHub Desktop.
Save seandenigris/942676 to your computer and use it in GitHub Desktop.
Name sub albums
tell application "iTunes"
-- Change these two variables as you go for each sub-album
set sub_album_description to ""
set number_of_tracks_in_sub_album to 5
set imported_album_name to ""
-- Date string example "Monday, April 25, 2011 April 25, 2011 12:00:00 AM"
set timestamp_of_first_imported_track to date ""
set new_album_name to imported_album_name & " " & sub_album_description
-- I just imported the album
set track_list to tracks of playlist "Music" of source "Library" whose album is imported_album_name and date added is greater than timestamp_of_first_imported_track
-- I keep my iTunes Library sorted by import date descending, so it is backwards
set track_list to reverse of track_list
-- I keep my iTunes Library sorted by import date descending, so the
set sub_album_tracks to items 1 thru number_of_tracks_in_sub_album in track_list
repeat with t in sub_album_tracks
set album of t to new_album_name
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment