Skipping disliked songs in iTunes


I’m a big fan of iTunes, and am growing to love Apple Music. Two things I love about Apple Music is that I can follow my interest in popular music from around the world and can research different musicals to inform the one I’m writing (not to steal, but to learn what works for me and what doesn’t).

Recently, iTunes added the ability to not just flag songs you love but also flag those you dislike. But it didn’t provide a way to skip disliked songs. That bugged me.

Warning: Technospeak ahead.

 

I’m a long-time Mac person. And I knew macOS had a cool tool called AppleScript to automate tasks.

After some fiddling around with some help from tutorials Using Script Editor from Doug’s AppleScripts for iTunes and idle thoughts from MacScripter, I came up a script. All I have to do is launch both iTunes and this script and then dislike whichever songs I wish. The moment I dislike a song, it skips to the next un-disliked song nearly immediately. And if I play a playlist or album again, it skips the disliked song again. Yay!

The only glitch I’ve noticed – besides not being able to see at a glance which songs you’ve already loved or disliked – is that, if a disliked song starts at the very start of the track, I sometimes hear up to a second of the disliked song before it gets skipped, especially if I have two or more disliked songs in a row. A small price to pay.

I’ve tested in in Apple Music and Apple Radio for people who have Apple Music.

I don’t know what would happen if you use Apple Radio without an Apple Music subscription (not sure if you can still do that) and hit the hourly skip limit. I think you would get a continuous series of nags that you can’t skip the song. If that happens, quit Skip Disliked Songs. I don’t have a workaround.

And now the script:

global timeToWait

on idle
  tell application "System Events"
    if (exists process "iTunes") then
      tell application "iTunes"
        try
          if player state is not stopped then
            tell current track
              try
                if disliked is true then
                  next track
                end if
                return timeToWait
              on error
                return timeToWait
              end try
            end tell
          end if
        on error
          return timeToWait
        end try
      end tell
    end if
  end tell
end idle

on run
  set timeToWait to 0.5
end run

And for those not familiar with AppleScript, here are the (Mac-only) steps:

Do this once:

  1. In your applications folder, in the Utilities sub-folder, launch Script Editor.
  2. If you don’t see a little scroll icon – kind of looks like a fancy “s” – in the menu over to the right with all the other menu icons:
    1. In the menu, choose Script Editor > Preferences.
    2. In the General tab, check Show script menu in menu bar.
    3. In the General tab, check Show computer scripts.
    4. Click the close button.
  3. If you don’t get an “Untitled” window, choose File > New from the menu.
  4. Paste in the script above into the main editing area.
  5. Click the hammer icon to compile the script. If you get any errors, clear it out and try re-copying and re-pasting.
  6. In the File menu choose Export.
  7. Name the file Skip Disliked Songs.
  8. Navigate to your home folder.
  9. If you don’t see a Library folder, hold down the Option key to reveal it.
  10. Navigate to Library then Scripts.
  11. If you want to keep any future scripts you might add organized, create an Applications folder, then an iTunes folder inside that, and navigate down to it. But that’s up to you.
  12. In the File Format drop-down, choose Application.
  13. Then check Stay open after run handler. This application is meant to stay open and keep an ear on iTunes.
  14. Click Save

Once you’ve done that, do this each time you open iTunes:

  1. In the menu bar, over to the right, look for something that looks like an old-fashioned scroll of paper. That’s the Script menu.
  2. In the Script menu, choose Skip Disliked Songs.
  3. If you find that the tiny snippets of disliked song bother you, you can go back and change timeToWait to a smaller number, say 0.25. If you experience performance issues, change it to a larger number at the expense of a larger snippet.

You’re all set! Enjoy your music.

Fine print: This is free software. I disclaim all warrantees and liability for its use.

Advertisements

Tags: , ,

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: