robotsandcake / alfred-love-loved-music-workflow

Allows a user to mark the currently playing iTunes song as Loved or Unloved.
The Unlicense
1 stars 2 forks source link

Alfred Loved or Unloved Music Workflow

This Alfred.app workflow for macOS makes it easy for the user to set the currently playing song to "Loved" or "Unloved", which when coupled with an iTunes Smart Playlist means you can avoid the Barry Manilow and love the Orbital.

Download

You can download the workflow here.

Usage

When a song is playing in iTunes invoke Alfred in your favourite way and simply type the words "Loved" or "Unloved" depending on your emotional attachment to that particular song. Simples.

You will then be shown one of the following notifications depending on your choice:

Loving Notification

Loved Notification

Unloving Notification

UnLoved Notification

Alfred Preferences

When you first double-click and install the workflow you will see the following image:

Alfred Preferences

JavaScript/AppleScript Needed

The middle part of the workflow that does all of the work uses the following JavaScript, leveraging the osascript tool in AppleScript.

(function() {
  var track = Application("iTunes").currentTrack();
  var trackLoved = track.loved();
  var notification = (trackLoved ? "UnLoved" : "Loved") + ": " + track.name();
  track.loved = !trackLoved;
  return notification;
})()