The Fastest way to tag genres in Itunes

The fastest way to tag genres in Itunes with this applescript. Even when your iTunes is painful slow!

First open the “Applescript Editor” and create a new script, paste the following in the newly opened window:



tell application "Finder"
    set frontApp to name of first process whose frontmost is true
end tell
set currTrack to ""
set thisNum to false
tell application "iTunes"
    if player state = playing then
        set currTrack to current track
        set thisName to name of current track
        set thisArt to artist of current track
        set numList to {"Progressive House", "House", "Deep House", "Tech House", ""}
        set thisRating to rating of currTrack
        set thisGenre to genre of currTrack
        set songArt to ("'" & thisName & "' by " & thisArt)
    end if
end tell
tell application frontApp
    if currTrack = "" then
        beep
        tell application frontApp
            display dialog "There is no song playing." buttons "Ok" default button "0k" with icon note
        end tell
    else
        if thisRating ≠ 0 then
            set thisRating to 4
            set thisList to (choose from list numList with prompt "song:" & return & songArt & return default items thisRating OK button name "Select" with empty selection allowed and multiple selections allowed)
        else
            set thisList to (choose from list numList with prompt "song:" & return & songArt & return OK button name "Select" with empty selection allowed and multiple selections allowed)
        end if
    end if
end tell


if thisList ≠ false then
    tell application "iTunes"
        next track
    end tell
    
    --start next song playing from 45 seconds
    tell application "iTunes"
        if player state is playing then
            set player position to 45
        end if
    end tell
    
    set thisRating to ""
    set thisGenre to ""
    
    repeat with i from 1 to count of items of thisList
        set thisItem to item i of thisList
        set thisGenre to thisItem
        tell application "iTunes"
            set genre of currTrack to thisGenre
        end tell
    end repeat
end if

Now change the array with genres and play_time to your liking, when you select a genre the next song will auto play at your chosen time, then the genre is updated. While tagging in iTunes, it sometimes takes up 10 seconds before iTunes unfreezes and you are able to select your next song (especially huge 60000+ libraries). This way we make sure our next song is playing before updating the previous song’s genre.

Leave a Reply