Skip to content

How to sync my mp3 Songs rating in iTunes across multiple Libraries

2009 November 24
by tobi

By now, I havn’t find any good solution to share my mp3 across multiple systems and disks. I’ve some on my local machine, some at work and some on my external harddisk to archive. Luckily, when copying my tracks to another library duplicates are ignored. But what annoys me most is that my ratings don’t get copied, as iTunes doesn’t store it within the file. Some while ago I found a solution by storing the number of stars into the ‘Grouping’ Field, so I can recover the rating afterwards. Now, I came up with this little applescript do automate the write and recover process. Just run this script, copy you mp3 to the other library, run the script again, and voilá, you ratings are back – nice!

[shell]
(* small apple script to save rating into grouping field and
vice versa. Perfect to persitent store your rating witin the file
*)

tell application "iTunes"
repeat with stars from 1 to 5
set rating_value to stars * 20
set group_name to "" & stars & " Stars"

set sel to (every track whose rating is rating_value and grouping is "")
repeat with aTrack in sel
tell aTrack
set grouping to group_name
end tell
end repeat

set sel to (every track whose rating is 0 and grouping is group_name)
repeat with aTrack in sel
tell aTrack
set rating to rating_value
end tell
end repeat
end repeat
end tell
[/shell]

Btw. for each Star rating I do have a smart playlist which allows me to find those quickly.

Flattr this!

7 Responses
  1. tobi permalink*
    March 11, 2010

    hm weird, I just ran the script on my machine again and it worked fine with approx 10k files.. maybe it’s just too much files which causes a memory issue? dunno–

  2. David permalink
    March 10, 2010

    About 30,000. A lot, in other words.

  3. tobi permalink*
    March 8, 2010

    hm strange, how many files does your itunes have?

  4. David permalink
    March 7, 2010

    Oops, it actually didn’t work. It times out with the following error message:

    error “iTunes got an error: AppleEvent timed out.” number -1712

    Any ideas?

  5. David permalink
    March 7, 2010

    Thanks, worked perfectly. Great idea, I don’t know why no one had thought of this before.

  6. tobi permalink*
    March 6, 2010

    Hey David, ok this was an HTML encoding error, I fixed it. Use just the ampersand (&) instead of &

  7. David permalink
    March 6, 2010

    I tried your method but applescript stops and gives me an error that it expected end of line but found an unknown token at the first semi-colon on the line:
    set group_name to “” & stars & ” Stars”

    Any thoughts on how to fix that or why I’m getting that error? Otherwise, this seems like a great way to deal with this problem, which has annoyed me forever. Thanks!

Comments are closed.