9 Replies Latest reply: Jan 7, 2007 1:51 AM by chris_parker_uk
G. L. Gray Level 1 Level 1 (55 points)
I have recently purchased some "remastered" versions of albums I already owned and have been listening to for years. Since I have listened to them for years, I would like to "transfer" the play counts of the original songs to their remastered versions. Therefore, I would like to manually edit the play count of some of songs in iTunes. How do I do this? It is clear after a couple of attempts that manually editing the iTunes Music Library.xml file doesn't do it. The data must be stored in the "iTunes Library" file, but I don't know how to edit it. How can I manually edit play counts?

Any tips would be greatly appreciated.

Thank you.

Regards,
Gary

2.16 GHz MacBook Pro, Mac OS X (10.4.8), 2GB RAM, 7200 RPM HD
  • Chuck Konfrst Level 4 Level 4 (2,050 points)
    The only way I know of is to edit the XML file iTunes generates. In the iTunes Music folder is a file called "iTunes Music Library.xml". It lists each and every song, its tags, play count, etc. You could manually edit this for each song.

    If you choose to do so, becareful not to change the format of the file or anything.
  • G. L. Gray Level 1 Level 1 (55 points)
    I tried editing "iTunes Music Library.xml". Here is what I did:

    (1) Quit iTunes.

    (2) Open "iTunes Music Library.xml" in BBEdit.

    (3) Search for the song name of interest.

    (4) Change the number in:

    <key>Play Count</key><integer>84</integer>

    to the desired number.

    Every time I did this, iTunes would reset the number back to its original value after it is launched.

    Am I doing something wrong?

    Regards,
    Gary
  • Charles Minow Level 6 Level 6 (9,190 points)
    How can I
    manually edit play counts?

    Any tips would be greatly appreciated.


    You can use AppleScript. I whipped up a quick one that will do what you want. Just copy this text and paste it into the Script Editor in the AppleScript folder in your Applications folder:

    <pre class="command">tell application "iTunes"
    set sel to selection
    repeat with t in sel
    set trackname to the name of t
    set dialog_answers to display dialog "Enter a new play count for " & trackname & ":" default answer ""
    set newcount to text returned of dialog_answers as integer
    if button returned of dialog_answers is "OK" then
    set played count of t to newcount
    end if
    end repeat
    end tell</pre>Look in the Library folder in your account's home. There might be an iTunes folder. If there is, see if there's a "Scripts" folder inside it. If there is, save your script there, with a name like "Change Play Count". Choose "script" as the format. It'll show up in a new menu with a little script icon.

    You should be able to select a track or tracks in iTunes and use this script to change the play counts. It's kind of a quick hack, so there's not much in the way of error checking, and if you hit the "Cancel" button, it just stops, but it'll get you started...

    charlie
  • Chuck Konfrst Level 4 Level 4 (2,050 points)
    I thought for sure that would work - but I just tried it and it doesn't. Don't know why. Sorry. The only other thing I can think of is to play each song over and over again - not the whole song, but click to the end as soon as it starts...
  • G. L. Gray Level 1 Level 1 (55 points)
    The script works like a charm. Thank you sooooooooooo much for the solution.

    All the best,
    Gary
  • Charles Minow Level 6 Level 6 (9,190 points)
    I thought for sure that would work - but I just tried
    it and it doesn't. Don't know why.


    I seem to remember reading, and a quick Google search kind of confirms, that the XML file is re-written by iTunes when it closes, using the information from the other binary database file.

    Also, there's this procedure listed in Apple's support site that tells how to use the XML file to recreate your iTunes library. You might be able to use that procedure to get around iTunes re-writing the XML file. Just make sure you've backed up your other preferences, in case it doesn't work. (I didn't feel brave enough to try it).

    charlie
  • Charles Minow Level 6 Level 6 (9,190 points)
    Ahh, you're welcome.

    Happy listening,

    charlie
  • Chris CA Level 9 Level 9 (77,475 points)
    Note that iTunes itself does not use the library.xml file.
    This is generated by iTunes for use by other programs.

    Editing it will not affect iTunes in the slightest.

    http://www.limewire.com/english/content/ftc.shtml
  • chris_parker_uk Level 1 Level 1 (0 points)
    Being on Windows and not having the luxury of scripts

    In your particular case I do the following.

    1) I move the original/old files to a different location on the Hard Drive.
    2) Next I run Itunes and try to play those original files, but (obviously:) they're not there and itunes tells me that the source files cannot be found do I want to locate them..
    3) It's at this point that I point Itunes to the new remastered version on the HDD and the play count/rating etc is the same just links to the better version..

    Hope that helps..

    PS - I'm still on the look out for a way to manually or auto update the Play Count (without syncing everything else)

    PC