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


Click here to return to the 'Duplicate existing criteria in iTunes' Smart Playlists' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Duplicate existing criteria in iTunes' Smart Playlists
Authored by: DougAdams on Dec 15, '06 10:06:05AM
Slightly off-topic, but related. The AppleScripts in Export Smart Playlist Criteria, "Export Smart Playlist Criteria" and "Export Selected Smart Playlist Criteria", each export just the criteria of the selected Smart Playlist(s) to an XML file. This file can then be imported to any iTunes using the "Import" command in the File menu. Handy for backing up Smart Playlist criteria or for sharing your Smart Playlists' criteria with other users.

Just thought I'd mention.

---
Doug's AppleScripts for iTunes
http://www.dougscripts.com/itunes/

[ Reply to This | # ]

TextFactory to clean exported Smart Playlist xml files
Authored by: trekside on Dec 15, '06 01:06:57PM
I have to frequently duplicate criteria, so the option-click and dougscripts solutions are awesome. Those are great hints. Thanks.

My goofy solution to copying and re-importing Smart Playlist criteria is below.

The scripts at http://www.dougscripts.com/itunes are awesome. However I was unable to make "Export Smart Playlist Criteria" and "Export Selected Smart Playlist Criteria" to work. I end up with "Error: Can't get criteria of a selected Smart Playlist." and "Error: Can't get criteria of the selected Smart Playlist. If this is a new Smart Playlist, try quitting and restarting iTunes so that iTunes is able to update its database." Don't let that stop you though, the scripts at http://www.dougscripts.com/itunes are really cool.

I am disappointed that when I export a Smart Playlist it includes all of the tracknames and other bloat. If I import one of these bloated playlists it takes time to import; it looks to me like iTunes is comparing the tracks to what is in the library. Also, I don't like that I can't export a Smart Playlist that has no current matches from the Library: an empty playlist can't be exported.

I do like that I can strip out that information and save a smaller file. I like that I can import or share my exported Smart Playlists with other users and accounts. I like that the import is faster. Each time a Smart Playlist is imported I get another new copy of the Smart Playlist. Cool. When I export all my Playlists they are 298.6MB; after I strip them of the track data they are 2.1MB.

Opening up an exported Smart Playlist .xml file with Property List Editor, allows me to delete these two key sections:
/Tracks
/Playlists/0/Playlist Items

I don't really know any grep stuff, but I cobbled together a TextFactory, that tell BBEdit to use, to recursively clean folders of xml files, (TextFactories work in in the free TextWrangler, but have to be created in BBEdit):

Replace All
Use Grep
Search for
\t<key>Tracks</key>\r\t<dict>\r\t\t<key>(?s).*\r\t\t</dict>\r\t</dict>\r
Replace With
[nothing]

Replace All
Use Grep
Search For
\t\t\t<key>Playlist Items</key>\r\t\t\t<array>\r\t\t\t\t(?s).*\t\t\t\t</dict>\r\t\t\t</array>\r
Replace With
[nothing]

My TextFactory cleans all of my Smart Playlists in a few seconds. Once I troubleshoot my problem with the dougscripts and can use them instead, my backups will be fast.

[ Reply to This | # ]
TextFactory to clean exported Smart Playlist xml files
Authored by: DougAdams on Dec 15, '06 03:00:26PM
I'm sorry you had trouble with the scripts :(

To clarify, the scripts mentioned only dump the Smart Playlist criteria, not any track info--that is up to iTunes to decide once the criteria is "Imported...".

As with most scripts, you can trouble-shoot 'em by running them in Script Editor with the Event Log selected. Check for errors, path problems, and so on, after the script fails.

Cheers! Thanks!

---
Doug's AppleScripts for iTunes
http://www.dougscripts.com/itunes/

[ Reply to This | # ]