Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Rate iTunes songs on a wider scale' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Rate iTunes songs on a wider scale
Authored by: Eravau on Feb 01, '05 05:34:42PM
I've been using the following script for a year or two. I have it saved as n doing the modifications in case the next track starts playing (thus changing the "current track") while you're still deciding what to rate the past one. Lastly, if you rate the track 10 or less it automatically deactivates that track (unchecks it) and moves the playhead position to one second from the end of an application and have a keyboard shortcut assigned to it so that I can pop up the rating dialog no matter what application I'm in at the moment. It's similar to the above, but with a few additional features. My rating dialog box shows the artist and song title. It refereces the track being modified by ID rather than "current track" whethe track. I did this mostly because I assume that if I (or you) would rate something that low, you probably don't really want to hear it again. Feel free to modify to taste.
tell application "iTunes"
    set curr_rating to the rating of the current track as text
    set curr_track to the name of the current track
    set curr_artist to the artist of the current track
    set curr_dur to the duration of the current track
    set curr_dbid to the database ID of the current track
end tell
set rate_dialog to (display dialog ("Rate "" & curr_track & "" by " & curr_artist) default answer curr_rating buttons {"Rate", "Cancel"} default button 1)
set new_rating to text returned of rate_dialog
if button returned of rate_dialog is "Rate" then
    tell application "iTunes"
        set rating of every track of playlist 1 whose database ID is curr_dbid to new_rating as number
        if new_rating < 11 then
            set played date of every track of playlist 1 whose database ID is curr_dbid to current date
            set enabled of every track of playlist 1 whose database ID is curr_dbid to false
            if the database ID of the current track is curr_dbid then
                set player position to (curr_dur - 1)
            end if
        end if
    end tell
end if


[ Reply to This | # ]
Rate iTunes songs on a wider scale
Authored by: Eravau on Feb 01, '05 05:38:32PM
Also, if you don't want to rate the currently playing track, but instead want to rate the selected track, change any occurance of "current track" (lines 2-6 of the script) to "selection".

[ Reply to This | # ]
Rate iTunes songs on a wider scale
Authored by: robartsd on Mar 23, '05 01:45:31AM

Here's my first script to set the rating. This one is for a selection (supporting multiple tracks). The default rating is the average of the current ratings.


tell application "iTunes"
	set dialogText to ""
	set adverageRating to 0
	set myTracks to get {name, rating} of selection
	repeat with myTrack from 1 to length of first item of myTracks
		set dialogText to dialogText & "Track: " & item myTrack of first item of myTracks & "
			Rating: " & item myTrack of second item of myTracks & "
"
		set adverageRating to adverageRating + (item myTrack of second item of myTracks)
	end repeat
	set adverageRating to {adverageRating / (length of second item of myTracks)} as integer
	set reply to display dialog dialogText default answer adverageRating
	if button returned of reply is "OK" then
		set rating of selection to text returned of reply as integer
	end if
end tell


[ Reply to This | # ]
Rate iTunes songs on a wider scale
Authored by: Eravau on Feb 01, '05 05:42:37PM

Sorry about the munging of the intro paragraph above. It should read:

I've been using the following script for a year or two. I have it saved as an application and have a keyboard shortcut assigned to it so that I can pop up the rating dialog no matter what application I'm in at the moment. It's similar to the above, but with a few additional features. My rating dialog box shows the artist and song title. It refereces the track being modified by ID rather than "current track" when doing the modifications in case the next track starts playing (thus changing the "current track") while you're still deciding what to rate the intended one. Lastly, if you rate the track 10 or less it automatically deactivates that track (unchecks it) and moves the play head position to one second from the end of the track. I did this mostly because I assume that if I (or you) would rate something that low, you probably don't really want to hear it again. Feel free to modify to taste.



[ Reply to This | # ]