Skip to content

Instantly share code, notes, and snippets.

@Velrok
Created January 9, 2010 11:43
Show Gist options
  • Save Velrok/272869 to your computer and use it in GitHub Desktop.
Save Velrok/272869 to your computer and use it in GitHub Desktop.
tell application "iTunes"
set playedBony to 2
set skippPanelty to 10
if not (user playlist "rate me" exists) then
display dialog "Dieses Script arbeitet auf der Playlist 'rate me' bitte erstellen Sie diese Liste.
Tipp:
Erstellen sie eine inteligente Wiedergabeliste die alle Audiodateien enthält die mehr als ein mal gespielt oder übersprungen wurden oder keine Wertung haben."
return
end if
repeat with song in file tracks of user playlist "rate me" #iterate throw all song in the library
if ((podcast of song = false) and (kind of song contains "Audiodatei")) then #only rate audiofiles
#
# init new songs
#
if rating of song = 0 then # not rated jet
set rating of song to 50
end if
#############
# song rating action
#############
set rating of song to (rating of song) + (played count of song) * playedBony
set rating of song to (rating of song) - (skipped count of song) * skippPanelty
##############
# clean up
##############
# ajust rating
if rating of song = 0 then
# 0 means new so set rating to at least 10
set rating of song to 10
else if rating of song > 100 then
set rating of song to 100
end if
# reset played and skipped count
set played count of song to 0
set skipped count of song to 0
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment