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

Transfer iTunes song ratings after re-ripping library Apps
I originally ripped my entire CD collection into iTunes at the 128 kbps quality setting, but recently I decided to re-rip it at 256 kbps. After completing the re-rip, a problem remained: All of the song ratings in my old iTunes library were now absent from the new one.

Luckily, I had exported the old iTunes library database using the File » Export command, so all of my ratings were preserved. The only trick was transferring the ratings from the export file into the new iTunes library. Doing so manually would have required many hours of tedious work, so instead I wrote an AppleScript to automate the process:
-- Apply iTunes Song Ratings 1.0
-- By Trevor Harmon <email available in source download>
-- License: GPL - http://www.gnu.org/copyleft/gpl.html

(*
This script takes as input a Music.txt file created with iTunes' File > Export command. It then applies the song ratings found in this file to the same songs in the current iTunes library. The song name, artist, and album must match; otherwise, the rating will not be affected. If they do match, the current rating will be replaced.

IMPORTANT: Before running this script, the Music.txt file must be encoded as UTF-8. To do so, simply open Music.txt in TextEdit (or a similar editor) and re-save the file with UTF-8 encoding.
*)

set the_file to choose file
set music_lines to read the_file using delimiter {return}

display dialog "This script may take a very long time to run, depending on the size of your iTunes library. (Processing a 2000-song library required approximately 20 minutes on a 2.5 GHz MacBook Pro.)" & return & return & "Do you still want to continue?"

-- Split the line at tab stops
set text item delimiters to ASCII character 9

-- Start at 2 instead of 1 to skip the header line
repeat with i from 2 to count music_lines
  set music_line to item i of music_lines
  set music_fields to every text item of music_line
  if length of music_fields is 27 then
    set the_name to item 1 of music_fields
    set the_artist to item 2 of music_fields
    set the_album to item 4 of music_fields
    set the_rating to item 26 of music_fields
    tell application "iTunes"
      set the_tracks to (file tracks of library playlist 1 whose name is the_name and artist is the_artist and album is the_album)
      repeat with the_track in the_tracks
        set the rating of the_track to the_rating
      end repeat
    end tell
  end if
end repeat
The script takes as input the Music.txt file created with iTunes' File > Export command. It then applies the song ratings found in this file to the same songs in the current iTunes library. The song name, artist, and album must match; otherwise, the rating will not be affected. If they do match, the current rating will be replaced.

Note: Before running the script, the Music.txt file must be encoded as UTF-8. To do so, simply open the file in TextEdit (or a similar editor) and re-save the file with UTF-8 encoding. The script is also available from my site [136KB download].
    •    
  • Currently 3.43 / 5
  You rated: 3 / 5 (7 votes cast)
 
[14,476 views]  

Transfer iTunes song ratings after re-ripping library | 6 comments | Create New Account
Click here to return to the 'Transfer iTunes song ratings after re-ripping library' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Transfer iTunes song ratings after re-ripping library
Authored by: lokon1979 on Apr 01, '08 11:41:22AM

normally if you import a cd that you already have it in your iTunes library, iTunes will ask you if you want to import a duplicate copy or if you want to replace your current music in your library. choose replace will retain all your rating, play count, etc

only if the tracks name that iTunes get from the internet for the CD is different from those in your library. sometimes for those old CDs you imported with early year iTunes, the naming may be different when you insert the same CD now (sometimes just upper or lower case, sometimes may be a space or a dash)



[ Reply to This | # ]
Transfer iTunes song ratings after re-ripping library
Authored by: pecosbill on Apr 01, '08 11:55:24AM

With everything backed up (except the actual music files), I'd be very curious to see what happened if you just imported the exported library into a new library. The music files would have to be in the same location/pathing, of course.

---
Pecos Bill



[ Reply to This | # ]
Transfer iTunes song ratings after re-ripping library
Authored by: joshforman on Apr 01, '08 12:13:45PM
I just found this scriptat the good ol' Doug's AppleScript site:
This script lets you copy specfic tag data from the selected tracks to a second set of selected tracks. You can copy any combination of Song Name, Artist, Album, Album Artist, Composer, Grouping, Last Played Date, Rating, Play Count, Artwork, Genre, Comments, and Year.
I had written something similar for myself, but it stinks. I like this one better.

---
Josh Forman

http://www.joshforman.com/

[ Reply to This | # ]

Transfer iTunes song ratings after re-ripping library
Authored by: morespace54 on Apr 02, '08 02:18:09PM

Maybe I'm missing something here (and I probably do) because I don't see why you couldn't simply export your Library?

Select "Music", then select "Export" (not "Export Library") then you have a text file with all the information for each track (namely "My Rating").

You can now import that text file in iTunes. Every track that is in the text file and in your iTunes (folder) will get the information (last played, rating, etc.)

Of course, tracks from the text file that don't appear in iTunes will be skipped. Note that they also must be on the same path but you could simply do a Search and Replace and remove that information from the text file (it won't stop iTunes from adding the rest of the information properly).



[ Reply to This | # ]
Transfer iTunes song ratings after re-ripping library
Authored by: e28eta on Sep 21, '11 10:14:59PM
I found this helpful, and posted a copy of the script on GitHub, and then enhanced it to also copy play counts, last played, skip counts, and last skipped. I had some trouble with type coercion to numbers and dates when they were empty, so the script isn't as elegant as it probably could be, but it worked for my 4700 songs that I transferred to a new computer/new library.

[ Reply to This | # ]
Transfer iTunes song ratings after re-ripping library (XML v TXT)
Authored by: drengfer on Nov 03, '12 07:21:32AM

I believe that this script is what I need. I have two libraries, neither a proper subset of the other. I want to "clone" (transfer, apply, copy) the ratings from one library to the other, for those songs that match. That appears to be what this script does.

However, iTunes now creates a .XML database export (not .TXT), and the format appears to be quite different from what this script is expecting.

Has anyone updated this script (or one like it) to parse and process the XML file? Alternatively, is there (still) a way for me to generate a "music.txt" file that will be compatible with this script?

TIA!



[ Reply to This | # ]