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


Click here to return to the 'Random Albums' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Random Albums
Authored by: Diggory on Aug 15, '03 12:20:47PM

I wrote the following for someone on the MacNN board who wanted it - someone else might want it too so here goes:

{what it does: alter an existing playlist called "randomAlbums" so that it contains enough whole albums picked at random to fit an iPod. To use it set up your iPod to only sync with the playlist "randomAlbums"}

n.b. alter the size of iPodCapacity to match your iPod.

tell application "iTunes"

set iPodCapacity to 9.25 -- In Gigabytes
set iPodCapacityInBytes to (iPodCapacity * 1024 * 1024 * 1024)
set ipodPlaylist to playlist named "randomAlbums"
set addedAlbumsList to {}

tell ipodPlaylist
delete tracks
end tell

repeat while ((size of ipodPlaylist) tell library playlist named "Library"
set randomAlbumName to album of some file track
repeat while (addedAlbumsList contains randomAlbumName)
set randomAlbumName to album of some file track
end repeat

copy randomAlbumName to the end of addedAlbumsList

-- log addedAlbumsList
set randomAlbum to location of file tracks whose album is randomAlbumName
end tell
add randomAlbum to ipodPlaylist
end repeat

update iPod

end tell


---
*****
monkeyfood software - http://www.monkeyfood.com

[ Reply to This | # ]

Random Albums
Authored by: reinhart on Aug 16, '03 11:22:01AM

I can't get this script to run:
I get the following error:

expected "," found "tell"

any ideas?



[ Reply to This | # ]
Whoops, copy & paste error
Authored by: Diggory on Aug 16, '03 11:30:50AM
the part that reads: repeat while ((size of ipodPlaylist) tell library playlist named "Library" set randomAlbumName to album of some file track repeat while (addedAlbumsList contains randomAlbumName) set randomAlbumName to album of some file track end repeat

should read:

repeat while ((size of ipodPlaylist)) tell library playlist named "Library" set randomAlbumName to album of some file track repeat while (addedAlbumsList contains randomAlbumName) set randomAlbumName to album of some file track end repeat

---
*****
monkeyfood software - http://www.monkeyfood.com

[ Reply to This | # ]