Skip to content

Instantly share code, notes, and snippets.

@atomicules
Created March 24, 2011 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomicules/884917 to your computer and use it in GitHub Desktop.
Save atomicules/884917 to your computer and use it in GitHub Desktop.
iTunes script - Set Composer to Album. Note that this information is probably out of date. It is being added here for reference/archival purposes and relates to a blog post from 2005
-- This script utilises the Composer field of a track so that you can browse through full albums only on your iPod.
-- Suitable for those who don't sync their full library to their iPod, but do sync a mixture of full albums and individual tracks (from full albums from their iTunes library).
-- It avoids having to suffer the usual 'browse by album' view on your iPod being cluttered with albums with one or few tracks.
--
-- BACKGROUND INFO:
--
-- I have an iPod mini so I don't sync everything from my iTunes library. I ALWAYS sync about 7 non-smart playlists (i.e. hand picked playlists) that are based on genre, mood, etc. I then have another playlist that I dump full albums into, lets call it iP_full_albums. I then have a smart playlist that adds in recently added tracks. I use another couple of smart playlists to sort the songs on my ipod (i.e. they don't add any tracks from the library to my ipod, but reference the afore mentioned playlists) and filter by rating, least played, etc. I then manually adjust the number of albums on my iP_full_albums playlist so it all fits onto my iPod.
--
-- THE PROBLEM:
--
-- It's pretty impossible using the iPod interface to easily browse through the full albums I've placed on my iPod, since you can't browse a playlist by album, only the entire music collection. Bit of a nuisance since the album view becomes cluttered with albums containing one or two tracks, etc from my non-smart playlists.
-- So, what I decided to do was to make use of the composer field. I don't much care who composed a track, so it's not important for me to keep this info.
-- I use a smart playlist called iP_full_albumsX that selects everything not in my iP_full_albums playlist AND that has a non-blank comment field.
-- The first part of this script then runs through the iP_full_albumsX playlist and sets the composer fields to blank.
-- The second part of the script then runs through the iP_full_albums playlist and sets the composer field of each track to "<album>". Then when I browse by composer on my iPod it is easy to browse the list of complete albums I have on my iPod. Happiness at last.
--
-- DRAWBACKS
--
-- Obviously, if you like to use your composer field properly, this won't work for you. I had toyed with the idea of automatically creating album playlists from my 'master' iP_full_albums playlist and then syncing these to my iPod. I'm sure this could be done (based on one of the existing album playlists scripts, but its a lot more work and not as elegant in my eyes.
-- Also, if like me, you have more than one iPod synced to your library things could get messy. For me it isn't a huge problem, since my wife uses hers more simplistically and isn't going to care (or notice) what I'm doing to the composer field. Can't think of any guaranteed away around this. If only you could browse by more fields on the iPod.
--** Either change so just renames as albums or filter it so compilations and Singles are renamed as album only**UPDATE: Change done, renames just as albums
tell application "iTunes"
activate
try
--PART 1 - set all tracks not in ipod album playlist so the composer field is blank again
--change iP_full_albums to suit
set first_playlist to "iP_full_albumsX"
set the view of the front browser window to playlist first_playlist
set oldfi1 to fixed indexing
set fixed indexing to true
set first_composer to ""
--ignore below two lines kept for reference for another way of doing the repeat routine
--set number_tracks to (number of tracks of playlist this_playlist) as string
--display dialog number_tracks
repeat with first_track in (get every track of playlist first_playlist)
set the composer of first_track to first_composer
end repeat
--Again, ignore below two lines kept for reference as another way of doing repeat routine.
--repeat with i from 1 to the (count of tracks) of this_playlist
--set the composer of track i of playlist this_playlist to this_composer
set fixed indexing to oldfi1
--PART 2, set the composer field of tracks in ipod album list so it is named "album"
--Change the iP_full_albums playlist to suit
set second_playlist to "iP_full_albums"
set the view of the front browser window to playlist second_playlist
set oldfi2 to fixed indexing
set fixed indexing to true
repeat with second_track in (get every track of playlist second_playlist)
--set track_artist to the artist of second_track
set track_album to the album of second_track
set second_composer to track_album
if the composer of second_track is not equal to second_composer then
set the composer of second_track to second_composer
end if
end repeat
set fixed indexing to oldfi2
end try
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment