I wrote a couple of “quick actions” for Mac that can love and dislike songs easily without going into the Apple music app. Rating, loving and disliking songs in apple music helps the app to suggest music based on your interests. Without the input of love, rating and disliking, the apple music would suggest you songs only based on your play and skipping of songs. I will give you my applescript that can even be executed in the “Scripts app”, or just used as an app and then can be easily executed using the “Spotlight” or “Alfred” app.
What is Quick Action?
How to write a quick action for loving a song and rating it three star and up??
I will list the steps you need to follow to write a simple quick action. For details visit here.
Open Automator app. This is default app on MacOS and can be open via Spotlight, or by going into the applications folder or launchpad.
Select “Quick Action” from the dialog menu and click “Choose”.
On the left side, search “Run AppleScript” in the list of available actions.
Drag it to the right side workflow space.
Copy and paste the following script by replacing the text “(_ Your script goes here _)”.
if application "Music" is running then tell application "Music" if player state ≠ stopped and not loved of current track then set loved of current track to true end if set thisRating to rating of current track if thisRating < 60 then set thisRating to 60 set rating of current track to thisRating else if thisRating ≥ 60 and thisRating < 100 then set thisRating to thisRating + 20 set rating of current track to thisRating else set theDialogText to "Rating of current song is maximum of " & (rating of current track) & "." display dialog theDialogText end if end tell end if
This script first checks whether the “Music” app is running, then if the play is not stopped and the current track is not loved then it will love it. It will also assign the rating of 60 (three stars) to the track if it has not been previously rated. It it has been rated and has a rating of 60 and over then it will add 20 each time this quick action is executed. If the rating is maximum (100 or 5 stars) then it will show a dialog box that the rating is maximum.
Save the quick action to your desired name. I saved it to loveMUSIC.
Now, you can quickly love the music playing on the apple music app. And it will automatically assign the rating of three star the first time you love it. Next time when you execute this “quick action” then it will make the rating 4 stars and then 5 stars.
How to write a quick action for disliking a song and rating it one star and skipping the track??
The steps are similar as the previous section. The applescript for this workflow is:
if application "Music" is running then tell application "Music" if player state ≠ stopped and not loved of current track then set disliked of current track to true set rating of current track to 20 next track else if player state ≠ stopped and loved of current track then set loved of current track to false set currRating to rating of current track if currRating > 40 then set rating of current track to currRating - 20 next track end if end if end tell end if
Applescript to rate and love the tracks in apple music app
We need to first work on the algorithm. My algorithm is simple:
- Since there are already many songs in my library that has not been rated, but has been played and skipped many times. So, I will rate the song
+5if the song has been played once and
-5if it has been skipped once. NOTE: You can choose it to be
1or even less based on your usage. If you listen to songs a lot and most of your songs are played over 20 times then it will be ridiculous to use the value of
5otherwise most of the songs will have 5 stars (100 ratings).
- If the rating exceeds
70, then it will be automatically be
- The maximum rating is
100(5 stars) and minimum rating is