2

I'm in the process of replacing my low quality <192 kpbs MP3s into either 320 kpbs MP3 or ALAC files in iTunes.

Right now my routine is to import the new HQ files to iTunes, go to "Show Duplicate items" mode, sort according to Song Name, manually replace the star ratings and using Doug's Applescripts to add the new Play Count to the new songs.

Anyone have a better and faster way of doing this? I have a large library and it's really cumbersome manually replacing ratings and play count for the same song but in higher quality. I searched Doug's page but can't find anything like what I'm describing.

Thanks

3

Here is my little script to do what you are asking for. Tested on a couple of tracks on my iTunes 11 under Snow Leopard and it run just fine.

tell application "iTunes"

    set myMusicLib to some playlist whose special kind is Music
    log "Debug: Count of library items: " & (count of tracks of myMusicLib)

    set myNewTracks to (get tracks in myMusicLib whose bit rate is greater than 256)
    log "Debug: Count hi bit rate tracks: " & (count of myNewTracks)

    repeat with newTrack in myNewTracks

        -- Try to match it with a low bit rate track
        set trackName to name of newTrack
        set albumName to album of newTrack

        --log "Debug: Hi Rate Track Name: " & (get name of newTrack)
        --log "Debug: Rate: " & (get bit rate of newTrack)

        set oldTracks to {}
        try
            set oldTracks to (get tracks in myMusicLib ¬
                whose bit rate is less than 256 ¬
                and name is trackName ¬
                and album is albumName)
        end try

        if (count of oldTracks) is 1 then
            log "Debug: Dup Name: " & trackName
            log "Debug: BitRate: " & (get bit rate of item 1 of oldTracks)

            set oldPlayCount to (get played count of item 1 of oldTracks)
            set played count of newTrack to oldPlayCount
            log "Debug: Reset Play Count to: " & oldPlayCount

            set oldRating to (get rating of item 1 of oldTracks)
            set rating of newTrack to oldRating
            log "Debug: Reset rating to: " & oldRating
        end if
        if (count of oldTracks) is greater than 1 then
            log "ERROR: Found more than 1 duplicate. Not doing anything."
        end if
    end repeat
end tell

EDIT:

You can get a glimpse of what is going on by looking at the output it sents to the Events pane. Just run it inside the Applescript Editor and click on the Events & Replies buttons to unhighlight them.

Output of script


EDIT2:

To limit the script you can change the line

set myNewTracks to (get tracks in myMusicLib whose bit rate is greater than 256)

to

set myNewTracks to (get tracks in myMusicLib whose bit rate is greater than 256 and Album is "My Album Name")

  • Oh gosh, thank you so much for doing this for me! Should I just follow a guide like this: maclife.com/article/columns/… to run your script? (I've no experience in scripts, thanks) – vermilions Apr 14 '14 at 19:06
  • You are welcome. You can follow the instruction there and it should run fine but nothing will be displayed. If you run from inside the Applescript Editor you will see some information like shown in the edit to my answer above. – Vic Apr 14 '14 at 19:50
  • Hi again, Could I just apply this script to only a selection of songs in my library? I'm scared if I press run it might do something else and wreck havoc to my library. Thanks – vermilions May 20 '14 at 15:07
  • Sure, I understand. I've edited my answer to show which lines to change to limit the changes to a single album. – Vic May 20 '14 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .