Jump to content
DavidK

Rate iTunes Track

Recommended Posts

Just finished a quick workflow to rate the currently playing track in iTunes. Simple usage, type "rate x" where x is the star rating you want assigned to the track. 

 

 

EDIT:

Now supports much better reliability, 1/2 stars, two panel display, and keyboard shortcuts.

 

Latest version can be found here:

 

http://d.pr/f/Oysk

or

https://github.com/dklem/Alfred2-Rate-iTunes-Track

 

 

Screenshots:

 

Rate-iTunes.png?raw=true
 
Rate-iTunes-notification.png?raw=true
Edited by DavidK

Share this post


Link to post

Updated this to match the default output format used in Notification Center by Alfred for other iTunes actions.

 

RateiTunes.png

Edited by DavidK

Share this post


Link to post

Great job! I was wondering, is there any way to allow for 1/2 stars like 4.5? That would really make it perfect in my humble opinion. Anyways, great job and I hope to see more workflows soon.

Share this post


Link to post

I had no idea iTunes even supported half stars, though I guess it makes sense based on the X/100 scale iTunes uses for rating. Great, now I'm going to be combing through my iTunes library and re-rating everything!

 

With that said, I updated the extension to support half stars. Seems to work fine, but would appreciate any comments or test cases I might have missed.

 

Latest download links can be found in the top post.

Edited by DavidK

Share this post


Link to post

Seems to work fine right now. A couple songs wouldn't take the half star but that was in a small minority of test cases. All in all its a solid workflow. Thank you so much for working it out. 

Share this post


Link to post

David, I just had an idea. Is there a way to add onto your workflow certain ratings that you use a lot and set up shortcuts for those ratings? I use 4, 4.5 and 5 the most; sometimes I use 3 and 3.5. It'd be great to have a faster way to just jump to 4.5 or 5 without having to type rate 4.5. Maybe a keyword of 'rate5' that shows up which can be highlighted and entered. I don't know, maybe its not the smartest thing to do but I thought I'd pass it on to you to see what you think. 

 

Thanks again, been rating like a beast these last few hours. 

Share this post


Link to post

The newer versions of the Alfred 2 beta now provide a iTunes Commands action, which will allow you to set the rating of a song via a key combination. So, for instance you could set the control-command-4 key combination to rate the current song 4 stars. Unfortunately, the iTunes Commands Actions don't support 1/2 stars. However, the second bash script in my workflow does allow it.

 

You can easily add hotkeys to support any ratings you want, and just link them to my second script like in the picture below: In this example, I used command-option-4 to set to 4 stars.

 

hotkey.png

 

keyconfig.png

 

To address your second request, that's fairly simple as well assuming you don't need half stars. See below for an example:

 

keyword.png

 

 

 

With that said, I've been noticing some slowness and misfires due to the Applescript not completing quick enough. Basically, typing "rate 5" and hitting enter faster than the applescript can run will produce unexpected issues and will not always rate the track properly. (perhaps causing the 1/2 star issues you were seeing) I've got a really good idea to address this, but just need an hour or so to sit down and code it. I'll see if I can work that out later tonight.

 

Dave

Share this post


Link to post

Okay, updated the script again, and it seems to be significantly more reliable for me. Split out the Information panel from the "Action" panel. Seems that the {query} wasn't being passed correctly unless the applescript finished completely. So, if you are a fast typist, and typed "rate 5" too quick, it wouldn't pass the proper parameter to the rating script. That's all fixed with the 2 panel view noted in the original post.

 

Also, added support for hotkeys to rate the current track. Feel free to set those to whatever feels appropriate for you.

 

Latest (and final?) version can be found in the post at the top.

Edited by DavidK

Share this post


Link to post

Just tried this workflow, works brilliantly. Alfred is an amazing app supported by an amazing communiuty of developers and users.

Share this post


Link to post

Okay, updated the script again, and it seems to be significantly more reliable for me. Split out the Information panel from the "Action" panel. Seems that the {query} wasn't being passed correctly unless the applescript finished completely. So, if you are a fast typist, and typed "rate 5" too quick, it wouldn't pass the proper parameter to the rating script. That's all fixed with the 2 panel view noted in the original post.

 

Also, added support for hotkeys to rate the current track. Feel free to set those to whatever feels appropriate for you.

 

 

Latest (and final?) version can be found here:

 

http://d.pr/f/ZJsD

or

https://github.com/d...te-iTunes-Track

 

David, instead of multiple posts introducing updates and new features, you would probably be better served to just update the original post with the new update links. The reason is, many people may come to this thread, see the first post with the download link and never scroll down to see the following posts. 

Share this post


Link to post

David, instead of multiple posts introducing updates and new features, you would probably be better served to just update the original post with the new update links. The reason is, many people may come to this thread, see the first post with the download link and never scroll down to see the following posts. 

Seriously, this is a bit of a problem now. There are so many great workflows that are constantly getting updated but there is not good way of knowing what is the most updated version. I wish there was a way to fix this. 

Share this post


Link to post

Good point David. In this particular workflow, the latest version is linked in the top post as well as the latest github page. I'll edit the other posts in this thread to avoid any confusion.

Share this post


Link to post

Good point David. In this particular workflow, the latest version is linked in the top post as well as the latest github page. I'll edit the other posts in this thread to avoid any confusion.

 

Awesome, thank you sir :)

Share this post


Link to post

Great script. I rate a lot of songs - my whole library. I would love a version of the script that would skip to the next song if the rating was - say below 3. I tried to modify your script, but I don't know the languafe well enough. Is there anyone who could pose a snippet of code that would work?

 

Thanks.

Share this post


Link to post

Interesting idea. I just tested it, and this code snippet will skip a song if it's rated below 3. Add the code below after the following line in the bash script.

 

"osascript -e "tell application \"iTunes\" to set rating of current track to $rating"

if [[ "{query}" < 3 ]]; then
	osascript -e "tell application \"iTunes\" to next track"
fi

Share this post


Link to post

Thanks for this.  I added your "next track" line to mine as I'm listening to a playlist of "rating 0" and rating a song removes it from the playlist.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×