Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Using a Smart Playlist to sync small iPods Apps

This hint is similar to "Smart iTunes Playlist use for small iPods" but requires less work. Now that my music collection has exceeded my 5 GB iPod, I can no longer auto-sync my entire library. I don't really want to manually update the songs and playlists or uncheck all the songs I don't want updated. My solution is to create a Smart Playlist with the conditions Genre is not Spoken Word and Kind does not contain stream (You can choose whatever conditions make sense for you).

Next -- this is the key part -- limit the playlist to 4,500 MB (for a 5 GB iPod) selected by "most recently added." This will ensure that the playlist contains only as much as your iPod can hold and always includes your most recent additions. You could also select by highest rating, most often played, etc. Name the playlist "iPod Selection." Then in iPod Preferences, select "Automatically update selected playlists only" and make sure that iPod Selection is checked. To open iPod Preferences, select your iPod in the source list and look for a button in the lower right corner of the iTunes window. Now your iPod will be automatically updated with as many of your newest songs that it can hold -- and you won't have to think about it!

    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[11,171 views]  

Using a Smart Playlist to sync small iPods | 13 comments | Create New Account
Click here to return to the 'Using a Smart Playlist to sync small iPods' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using a Smart Playlist to sync small iPods
Authored by: fpatrick on Feb 20, '04 11:22:56AM

With a bit over 20 gigs of music and an old 5-gig iPod, my approach is to use a combination of several size-limited playlists.

One is a relatively small "New Songs" list (500 mb) based on "most recently added."

The second is a similarly sized "Been a While" list for "last played not in the last 10 months."

I've got a "Choice" list in which I include songs/albums I always (or temporarily) want, and keep an eye on it's size whenever I add something.

The last is a size-limited (5 gigs minus 1 gig (for new and been awhile) minus the "Choice" size" minus a few hundred MB for contacts and calendars) list for "Faves," based on "greater than 3 stars" and "least recently played."



[ Reply to This | # ]
Using a Smart Playlist to sync small iPods
Authored by: MacMuse26 on Feb 20, '04 11:58:52AM

Hey fpatrick - that's exactly what I do!

Even down to one manual playlist for special items of interest.

I also have a size limited Christmas list, but it is currently out of the rotation (all songs unchecked, playlist unchecked in iPod prefs). I also put the name of my iPod "42" (ala Hitchhiker reference) in front of all the playlist names so they organize better in iTunes.

Of course, I'd rather have a 40GB iPod :)



[ Reply to This | # ]
Using a Smart Playlist to sync small iPods
Authored by: sjonke on Feb 20, '04 12:23:13PM

I don't have my iPod mini yet, but I wrote an applescript that uses one smart playlist containing randomly selected songs limited to 1500 MB to generate another playlist that has full albums in it. It first clears out both lists which causes the smart playlist to reselect random songs for a fresh mix that is worthy on its own. Then it walks through those songs, pulls a random number out of a hat and if the number is less than some specifiable percent (currently 25% but it may prove necessary to tweak that number) it adds all the tracks from that album to the second playlist. The net results is a lengthy random track list and a random selection of the full albums those tracks are on, all fitting in somewhat less than 4 GB of space. Both playlists will be sync'd to the iPod. I'm anxious to put it in use, but my just-ordered-last-night green iPod mini is showing a 1 to 3 week wait. Sigh....

---
--- What?



[ Reply to This | # ]
Using a Smart Playlist to sync small iPods
Authored by: filmsmith on Feb 20, '04 12:37:24PM
Really? I just (nearly) finished a script that will copy all my songs from my 'New Releases' smart playlist to a playlist called 'Pack the 'Pod' and then proceed to fill up the rest of the user specified (defaults to 15 gigs) space with albums at random. My script is posted below for anyone who's interested. Also, if you would post your script, I'd love to compare notes!
property default_capacity : 15
property default_playlist : "Pack the 'Pod"
global the_capacity
global album_list

set album_list to {""}
tell application "iTunes"
	delete every track of playlist default_playlist
	with timeout of 360 seconds
		set default_capacity to text returned of (display dialog "How full shall I pack'r, Sir? (Please give your answer in Gigs)" default answer default_capacity giving up after 300) as integer
	end timeout
	set the_capacity to (default_capacity * 1.0E+9) as real
	my smart_playlist()
	my library_pack()
	repeat with i from 1 to (count of sources)
		if kind of source i = iPod then
			set the_pod to name of source i as text
			exit repeat
		end if
	end repeat
	try
		update the_pod
	end try
end tell

on smart_playlist()
	tell application "iTunes"
		set random_library to playlist "New Releases"
		set shuffle of random_library to false
		set track_counter to 1
		repeat while (size of playlist default_playlist) < (size of random_library)
			try
				set album_name to album of track track_counter of random_library
				if album_name is not in album_list and album_name is not "" then
					duplicate (get a reference to (every track in random_library whose album = album_name)) to playlist default_playlist
					set end of album_list to album_name
				else if album_name is "" then
					duplicate track track_counter to playlist default_playlist
				end if
				repeat with x from 1 to count of tracks of random_library
					if album of track (track_counter + x) of random_library is not album_name then
						set track_counter to (track_counter + x)
						exit repeat
					end if
				end repeat
			on error
				exit repeat
			end try
		end repeat
	end tell
end smart_playlist


on library_pack()
	tell application "iTunes"
		set random_library to playlist "Library" of source "Library"
		set shuffle of random_library to true
		set shuffle of random_library to false
		set shuffle of random_library to true
		set track_counter to 1
		repeat while (size of playlist default_playlist as real) < the_capacity
			if enabled of (track track_counter of random_library) is true then
				set album_name to album of track track_counter of random_library
				if album_name is not in album_list and album_name is not "" then
					duplicate (get a reference to (every track in random_library whose album = album_name)) to playlist default_playlist
					set end of album_list to album_name
				else if album_name is "" then
					duplicate track track_counter in random_library to playlist default_playlist
				end if
			end if
			set track_counter to track_counter + 1
		end repeat
	end tell
end library_pack

p.s. If anyone can find a way to optimize this as it takes about 15 minutes to complete, I'm very interested to hear it. I posted this to macscripter.net, but found little help.

[ Reply to This | # ]
Using a Smart Playlist to sync small iPods
Authored by: sjonke on Feb 20, '04 01:27:21PM
Mine's pretty simple. The trackPlaylist should be a smart playlist that selects tracks at random (or however) and is limited to some size (I have mine set to 1500 MB) and the albumPlaylist should be a regular playlist:

property trackPlaylist : "iPod Tracks"
property albumPlaylist : "iPod Albums"
property albumsPercent : 0.25

tell application "iTunes"
  delete every track of playlist trackPlaylist
  delete every track of playlist albumPlaylist
  delay 2
  
  if exists (window 1) then set view of window 1 to playlist albumPlaylist
  
  set theAlbums to {}
  repeat with x in every track of playlist trackPlaylist
    set currAlbum to album of x
    if theAlbums does not contain currAlbum then
      set theAlbums to theAlbums & currAlbum
      if (random number) < albumsPercent then
        duplicate (every track of playlist "Library" whose album is currAlbum) to playlist albumPlaylist
      end if
    end if
  end repeat
end tell
NOTE: if you put this in iTunes script menu then be sure to save it as an application and not a compiled script. When I run it as a compiled script from there, the "delay 2" seems to block iTunes and as a result the trackPlaylist doesn't update before the script starts iterating over it. It works fine as an application and it works fine as a compiled script from the shareware "FastScripts" menu. It takes about a minute to run on my 400 MHz iMac G3, but that is just an estimate - I haven't timed it.

---
--- What?

[ Reply to This | # ]

Using a Smart Playlist to sync small iPods
Authored by: filmsmith on Feb 20, '04 01:37:52PM

Dang. I never thought I'd have to say this but... yours is so much smaller and more efficient than mine.

Having compared the two, I see how to trim the bloat in mine, though I can only trim some. Mostly, I have extra lines to compensate for iTunes seemingly crappy 'Shuffle' system. However, a few lines in mine that I prefer are those that pass over tracks that aren't enabled and also includes tracks whose album fields are empty. I also threw in some stuff to update my iPod as soon as it's finished. Basically, I set this script to run when I wake up monday morning and by the time I'm ready to go, I have a newly randomized iPod with all the New Releases included.

I think I see why yours is faster than mine. Mine uses a brute force to try and find albums that haven't been chosen, so odds are good that, as the script nears completion, it will take longer to find unused albums. Yours seems to solve this with "if (random number) < albumsPercent then" though I'll need to test it this eve.

Thanks for hook-up. I'm always curious to see how other people tackle scrips.



[ Reply to This | # ]
Using a Smart Playlist to sync small iPods
Authored by: sjonke on Feb 20, '04 01:56:17PM

Regarding passing over tracks that aren't enabled, you get that for free by setting the smart playlist to only include enabled tracks! Use the smart playlist to do as much of the work as possible.

---
--- What?



[ Reply to This | # ]
Never mind! Here's the solution.
Authored by: sjonke on Feb 20, '04 01:59:27PM
Oh, never mind - I see what you mean. Good point. I changed the duplicate line to the following to resolve that:

duplicate (every track of playlist "Library" whose album is currAlbum and enabled is true) to playlist albumPlaylist

---
--- What?

[ Reply to This | # ]

Never mind! Here's the solution.
Authored by: filmsmith on Feb 20, '04 02:01:13PM

Look at that! Had no idea I could do it that way.

Thanks again!



[ Reply to This | # ]
Never mind! Here's the solution.
Authored by: sjonke on Feb 20, '04 02:12:23PM

There are some powerful constructs in Applescript, they're just poorly documented and inconsistently implemented. An application's dictionary only tells you half the story.

My script presumes you don't have two or more albums with the same name, though that is certainly possible. You could include the artist name in there (... and artist is someName) - I didn't put that in because it was easier/faster to just save the album name in a list and it's not an issue for my library.

---
--- What?



[ Reply to This | # ]
Using a Smart Playlist to sync small iPods
Authored by: RAMd®d on Feb 22, '04 09:59:54PM

Ok, I'm way out of my element here, but I want to do what you're about to do, once you get your Mini.

Two things-
*Now that the dust has settled, what does your script look like?
*Will the random selection be totally/randomly different each time you sync? Or will it be slightly different, based on the additions of new songs to iTunes?

What I'd really like is to be able to create playlists for my favorite groupings, and then randomly populate them *each* time I sync.

Thanks for the great info!



[ Reply to This | # ]
Using a Smart Playlist to sync small iPods
Authored by: bwareham on Feb 23, '04 10:42:09PM

I've written a shareware app that incorporates some of these techniques for managing larger mp3 collections on smaller iPods. To download the app or get more info go to http://www.visi.com/~bwareham/playlistblender.html



[ Reply to This | # ]
My iPod Mini Random Music Filling Scripts
Authored by: TigerKR on Aug 16, '04 09:40:01PM
It works in two parts, the first part creates a random playlist from a shuffled library of all of your music (using only checked tracks) up to a 3.5 GB size (leaves a little room on the mini for files), and then plays that playlist:

tell application "iTunes"
	
	if (exists user playlist "Completely Random") then
		delete user playlist "Completely Random"
	end if
	-- deletes existing Completely Random playlist if it exists
	
	set mainLibrary to get (a reference to library playlist 1)
	set shuffle of mainLibrary to true
	set shuffle of mainLibrary to false
	set shuffle of mainLibrary to true
	-- shuffles the main iTunes library
	
	copy (get a reference to (make new user playlist with properties {name:"Completely Random"})) to randomLibrary
	set i to 1
	tell mainLibrary
		repeat while (size of randomLibrary is less than 3.75E+9)
			try
				if (file track i is enabled) then
					duplicate file track i to randomLibrary
				end if --> if the song has been checked for playback
				set i to i + 1
			end try
		end repeat
	end tell
	-- copies the first 3.5GB of music from the shuffled iTunes library into the new Completely Random playlist
	
	set shuffle of mainLibrary to false
	set view of browser window 1 to randomLibrary
	play randomLibrary
	-- unshuffles main iTunes library and plays new Completely Random playlist
	
end tell
The second part wipes your iPod, and then transfers your new Completely Random playlist to your iPod:

tell application "iTunes"
	
	repeat with i from 1 to the count of sources
		if the kind of source i is iPod then
			set thePod to the name of source i as text
		end if
	end repeat
	-- find the iPod
	
	tell source thePod
		repeat with thePlaylist from 1 to the count of user playlists
			delete user playlist thePlaylist
		end repeat
	end tell
	-- delete every playlist in the iPod	
	
	tell source thePod
		delete every track of playlist thePod
	end tell
	-- delete every track in the iPod	
	
	make new user playlist at source thePod with properties {name:"Completely Random"}
	duplicate (every track in user playlist "Completely Random") to library playlist 1 in source thePod
	duplicate (every track in user playlist "Completely Random") to playlist "Completely Random" in source thePod
	-- copy Completely Random iTunes playlist into new playlist Completely Random in the iPod
	
end tell
Then you can access these scripts from the iTunes menu by saving them using (AppleScript) Script Editor into ~/Library/iTunes/Scripts/

[ Reply to This | # ]