13

I have 30 or so smart playlists defined in iTunes on the PC. What I'd like to do is export all of these definitions. To clarify, I don't want to export the songs in each of these playlists, I want to export the definition (e.g. "Artist contains Foo").

I have a lot of conditions defined for each playlist, and would prefer a solution that doesn't involve manually performing the same steps 30 times. For example, if I could export registry settings, this would be the best solution.

4 Answers 4

8

If you select a smart playlist, then choose File > Library > Export Playlist... and choose the XML file format, you can then use the corresponding Import Playlist... command from another iTunes library to import the smart playlist definition.

Unfortunately, iTunes only lets you select one playlist at a time, so there's no way to select multiple playlists and export them at the same time. You can do the "Export Library..." which does everything, but then you have all sorts of extra stuff you don't want.

If you're comfortable hacking around a bit though, you could export the whole library, then use PlistEdit Pro to edit the file and remove all the playlist and track dictionaries that you don't want, leaving just your smart playlists. Then you'd have all the playlist definitions in a single file that you can import into another iTunes library.

2
  • 1
    That Export Library is exactly what I needed. I was actually in the process of deleting everything from my iTunes Library and had only these playlists that I wanted to export, so the resulting xml file only had the playlist information and worked brilliantly. Thanks!
    – Senseful
    Oct 29, 2010 at 0:28
  • I have found that exporting the library and then re-importing it isn't that hard when you then have to go delete a few (perhaps even a dozen) duplicate playlists. It seems iTunes is getting better at suppressing exact duplicates, but if even one song is different in the playlists, you will get both upon importing.
    – bmike
    Nov 30, 2012 at 15:30
4

After rebuilding my SmartLists for the seemingly 100th time, I had to find a better way. I came up with a solution, but it takes some pre-planning - you have to export your lists as XML before you lose them. I then remove all song references from the XML file so the file only contains the SmartList parameters. Then when I need to restore the list (like after an update/upgrade), I simply import the XML file. Here are the instructions to save copies of your lists:

  • Right-click on your SmartList and choose Export, then be sure to select XML as Save As Filetype.
  • Open the .XML file with a text editor and search for <key>Playlists</key>. Set the cursor at the beginning of that line, then use your slide-bar to scroll all the way to the top. Select all lines from where you started up to the line that has <key>Tracks</key> , then delete those lines. (Deletes the <dict></dict> section under Tracks.)
  • Look for the line with <key>Playlist Items</key> . Skip the next line ( </dict> ), then click at the beginning of the next line. Scroll to the bottom of the file, then select all lines down to the third line from the bottom ( </array> ). Remove those lines. (Deletes the Playlist Items <array>)

Doing this reduces the XML file size (2k to 3k depending on the complexity of your list), and stores only the parameters of your SmartList, not the actual songs list. Importing these XML files will rebuild your song list, and this hasn't failed me yet. Remember to include these files with your backups so that you can recover these lists if your hard drive fails. Also remember to repeat the process if you ever change the parameters of your SmartList.

0

Mark Miller's answer is still working in 2023, however I figured out a neat trick to make editing the files a bit easier by vastly reducing their initial size.

If your smart playlist has 1000s of tracks, it's a PITA to make the edits, however what I do is add a simple criteria to the smart playlist to reduce the playlist to 1 track. You can use any trick you like, but I just tag a single song in the smart playlist with BPM of 1 and then add a smart rule that BPM must be 1. It's then simple to edit the exported xml per Mark's solution.

Then, when you restore the smart playlist, just remove the BPM rule, and you've got the desired playlist back!

iTunes will not let you export an empty smart playlist, there has to be something in it.

0

Following up on my answer from Aug 2023, I've found a much better solution for backing up ALL my iTunes smart playlists, again based on Mark Miller's excellent response. This is basically a way to automate what Mark has notated without having to hunt and peck through all the playlists.

First use the iTunes Advanced option to "Share iTunes Library XML with other applications" which will get you an xml file with all tracks and playlists.

I'm using Notepad++ in windows for finding/replacing the text blocks, I'm sure there's a mac text editor with similar functionality.

  1. Use the following regex in the find with nothing in the replace to remove all the tracks from the Tracks section:
<key>Tracks</key>(.*?)<key>Playlists</key> 

NOTE: You'll need to add back in the Playlists line after deleting all the tracks unless you have a better regex to find Tracks up to the "Playlists" section

  1. Use the following regex with a find/replace to remove the tracks from the actual smart playlists:
<key>Playlist Items(.*?)</array>

Make sure to select regex as the search mode and the option ". matches newline"

(My regex was not perfect so I needed to use the Notepad++ edit operation "Edit->Line Operations->Remove empty lines containing blank characters" to finish things up.)

That will delete all the tracks within a smart playlist. After all the tracks and playlist tracks are removed, you'll have an xml file that will only have the smart playlist definitions that you can import back into iTunes using the File->Library->Import Playlist option. My 67000+ track library file went from 115mb to 525kb.

Assuming you have re-imported all your tracks, then all the smart playlists will repopulate with the matching tracks.

regex for itunes playlist items

BEFORE:

        <dict>
            <key>Playlist ID</key><integer>508503</integer>
            <key>Parent Persistent ID</key><string>065740B95E8B8CC8</string>
            <key>Playlist Persistent ID</key><string>A899C3701858BAFE</string>
            <key>All Items</key><true/>
            <key>Name</key><string>Latin Pop</string>
            <key>Smart Info</key>
            <data>
            AQEAAwAAAAIAAAAZAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAA==
            </data>
            <key>Smart Criteria</key>
            <data>
            U0xzdAABAAEAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAU0xzdAABAAEAAAACAAAAAQAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAADwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAABEAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAB
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAg
            AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANJTTHN0AAEAAQAAAAEAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAACAEAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAABIATABhAHQAaQBuACAAUABvAHA=
            </data>
            <key>Playlist Items</key>
            <array>
                <dict>
                    <key>Track ID</key><integer>87521</integer>
                </dict>
[dozens or hundreds of Track IDs]
                <dict>
                    <key>Track ID</key><integer>15353</integer>
                </dict>
            </array>
        </dict>
        <dict>
            <key>Playlist ID</key><integer>2224854</integer>
            <key>Parent Persistent ID</key><string>065740B95E8B8CC8</string>
            <key>Playlist Persistent ID</key><string>A899C3701858BAFE</string>
            <key>All Items</key><true/>
            <key>Name</key><string>Latin Pop</string>
            <key>Smart Info</key>
            <data>
            AQEAAwAAAAIAAAAZAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAA==
            </data>
            <key>Smart Criteria</key>
            <data>
            U0xzdAABAAEAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAU0xzdAABAAEAAAACAAAAAQAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAADwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAABEAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAB
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAg
            AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANJTTHN0AAEAAQAAAAEAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAACAEAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAABIATABhAHQAaQBuACAAUABvAHA=
            </data>
        </dict>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .