Create an iTunes smart playlist of singles
August 3, 2014 6:54 PM
My iTunes library consists of 80% complete albums and 20% singles from bands. Without going through and tagging all those singles in any specific way, is there a way to create a smart playlist that will pull all the music with the criteria artist-has-only-one-track or something similar?
If you're on a Mac, this $2 app can create a "one-hit-wonder" list, where you only have one song by that artist in your library.
posted by hydrophonic at 9:11 PM on August 3, 2014
posted by hydrophonic at 9:11 PM on August 3, 2014
I am all about smart playlists but there's nothing in the model that lets you find find that — "album" is not an entity, it's an attribute of a song.
posted by Brainy at 9:14 PM on August 3, 2014
posted by Brainy at 9:14 PM on August 3, 2014
I wanted to do the same thing and not knowing about that app, I tagged all my albums. It took a while, but not as long as tagging all my singles.
posted by Kutsuwamushi at 5:00 AM on August 4, 2014
posted by Kutsuwamushi at 5:00 AM on August 4, 2014
This isn't the nicest code you'll ever see, but it will do the trick.
Save the following as one_hit_wonders.vbs
Don't forget to delete the playlist before you run it again, otherwise you'll end up with duplicates in your playlist.
posted by mr_silver at 3:48 PM on August 4, 2014
Save the following as one_hit_wonders.vbs
Option Explicit Dim oiTunes : Set oiTunes = CreateObject("iTunes.Application") Dim oMainLibrary : Set oMainLibrary = oiTunes.LibraryPlaylist Dim oPlayList : Set oPlaylist = oItunes.CreatePlaylist("One Hit Wonders") Dim iCount : iCount = oMainLibrary.Tracks.Count Dim sArtistArray(): Redim sArtistArray(iCount) ' Create an array in memory of just artist names, we'll use this to rapidly weed out ' the artists which are duplicates. Dim i : For i = 1 To iCount WScript.Echo "Scanning iTunes Library = " & i & "/" & iCount sArtistArray(i) = oMainLibrary.Tracks(i).Artist Next ' Iterate over this array removing all the artists that are listed ' more than once. This is way faster than scanning the iTunes ' library over and over again Dim j, bMatch : For i = 1 to iCount bMatch = False For j = 1 to iCount If i<>j And _ Len(sArtistArray(i)) > 0 And _ Len(sArtistArray(j)) > 0 And _ LCase(sArtistArray(i)) = LCase(sArtistArray(j)) Then sArtistArray(j) = "" bMatch = True End If Next If bMatch = True Then sArtistArray(i) = "" WScript.Echo "Removing artists = " & i & "/" & iCount Next ' If there is an artist in this array then they are unique so add that ' to a playlist For i = 1 to iCount If sArtistArray(i) <> "" Then WScript.Echo "Adding: " & oMainLibrary.Tracks(i).Name & " (" & oMainLibrary.Tracks(i).Artist & ")" oPlayList.AddTrack(oMainLibrary.Tracks.Item(i)) End If Next Set oPlayList = Nothing Set oMainLibrary = Nothing Set oiTunes = Nothing >>To run it, open a command line window and type cscript one_hit_wonders.vbs
Don't forget to delete the playlist before you run it again, otherwise you'll end up with duplicates in your playlist.
posted by mr_silver at 3:48 PM on August 4, 2014
mr_silver: Damn that is so awesome, I wish I was using windows to use it 8-) But mayhaps I can convert to AppleScript and get something similar going. Thanks for the idea
posted by ish__ at 11:26 AM on August 16, 2014
posted by ish__ at 11:26 AM on August 16, 2014
Sorry, I made the silly assumption you were using Windows :)
I did a quick Google search:
- This one does quite a bit more than just one hit wonders and is priced at $1.99.
- This one is free and written by someone else.
- This one was posted in a forum as a response to a question about one hit wonders.
I don't have OS X so I cannot test any of them, but hopefully one of these will work.
posted by mr_silver at 9:21 AM on August 19, 2014
I did a quick Google search:
- This one does quite a bit more than just one hit wonders and is priced at $1.99.
- This one is free and written by someone else.
- This one was posted in a forum as a response to a question about one hit wonders.
I don't have OS X so I cannot test any of them, but hopefully one of these will work.
posted by mr_silver at 9:21 AM on August 19, 2014
This thread is closed to new comments.
posted by hydrophonic at 8:30 PM on August 3, 2014