Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

The play count in my iTunes library has somehow become incorrect. It shows some songs as never been played while I know that I have played them many times before. These songs do still have a "last played" date though.

Also, some songs are being listed as only played once, while I know they have been played multiple times.

I have an iPhone 4S, with iOS 6.0.1, iTunes 11. My PC is a VAIO running on Windows 7. I have a backup of my iTunes account. I think the problem started after I updated my iTunes account to version 11.

What I need is to get my original play count data back. Can anyone help me with this?

share|improve this question
add comment

5 Answers 5

For minor play count screwups, I use a little AppleScript to set the count:

tell application "iTunes"
  activate
  set played count of track named "Vaseline Machine Gun" to 16
  return
end tell

Obviously this can be elaborated to handle more complicated situations involving multiple tracks and playlists.

share|improve this answer
    
As great as this is, do you have an answer that would work on iOS or on Windows since the questioner has those versions of iTunes at their immediate disposal from the wording of the question. –  bmike Jan 2 '13 at 21:09
    
@bmike Nope, other than the ugly "port everything to a mac, fix the counts, then port it back." It looks like there IS some windows side scripting possible (projects.nateweiss.com/nwdc/itunes/scripts), but I've never messed with it. –  Wayfaring Stranger Jan 2 '13 at 21:22
add comment

There's a bug in iTunes 11 where the play count isn't updated if you have crossfading of tracks turned on in the playback settings. This might account for some of it.

share|improve this answer
    
Thanks for the reply man. I'm not sure if crossfading caused the problem, in my case it was never turned on in the first place. –  Raphie Jan 3 '13 at 19:25
add comment

One way to correct the wrong playcount is to open a previous Itunes library and adjust the playcounts manually.

You could load the old library (which in my case is pretty similar to the new one, since it is only 1 month old) and manually adjust the playcounts (by playing the songs an extra number of times) and also manually adjust newly added songs etc. Of course, you could also just use the old library to identify wrong play counts and adjust them in the new library.

How to load the old library? Hold down SHIFT while you open Itunes (first press SHIFT, keep holding it down, then open Itunes). Itunes will ask you which Itunes library you want to open, click “Choose Library”, then click the folder “Previous Itunes Libraries”. Within that folder you will find a number of old ITL files (ITL stands for Itunes Library File, these files contain metadata like playcount etc.), choose the one with the date before you updated your Itunes to version 11 (in my case the name of the file was “iTunes Library 2012-12-02”). Itunes will now open the old library with the old playcounts, song names, last played etc. You can go back to the new library with the same SHIFT procedure but then choose "iTunes Library" in the "iTunes" folder.

Comparing the playcounts of the old and new library can( for example) be done in Excel. Simply select all the songs in Itunes (CTRL A, CTRL C) and paste them in Excel (CTRL V), don’t forget to sort by name first.

Hope this helps.

Ciao, Raphie

share|improve this answer
add comment

Summary

If you quit iTunes and empty the contents of your iTunes Library.itl file, then iTunes will rebuild your library from the contents of iTunes Media Library.xml. Make sure it's up to date by exporting your library and copying the file, and then edit the play counts inside. When you restart iTunes, it will use the XML file and your edited information will be accepted.

Step-by-step

Retrieve previous information:

If you have backups of your iTunes library, find the most recent version of iTunes Media Library.xml from before the problem. Within this file, search for the songs whose play counts you want to restore. You'll be looking for this:

<key>Play Count</key><integer>1337</integer>

Now you know what the accurate play counts were. Copy and paste them into a text file or something so you can put them in your current library next.

Modify current library:

This is the tricky part, so back up your files before editing them.

  1. Use File > Library > Export Library… to get an up-to-date XML representation of your library. I'll refer to this file as Library.xml.

  2. Exit iTunes and use the Task Manager to make sure it (and the iTunes Helper) are well and truly dead.

  3. Navigate to your iTunes folder. Replace the contents of iTunes Media Library.xml and iTunes Library.xml with your newly created Library.xml. This will ensure that they're up to date.

  4. Change the play counts in the iTunes Media Library.xml file. This file is about to become the basis for your library's metadata.

  5. Remove the contents of your iTunes Library.itl file. The file itself needs to exist, but it must be empty so that iTunes will fall back to iTunes Media Library.xml. (more info) If everything works, you will not need the old contents of this file.

  6. Restart iTunes. It will report that your library is corrupted, so it will fall back to the XML file that you've edited and rebuild the .itl file. After it's finished, you'll see the play counts from iTunes Media Library.xml.


I haven't verified that there's absolutely no data loss with this method, but my library appeared fully intact when I tested it with iTunes 11 on OS X 10.8. Always back up your files before tweaking. Enjoy!

share|improve this answer
add comment

Here's the real, heavy duty power solution:

Use Notepad to create a new file named: iTunes_SetPlayCount.VBS

Use this script:


Dim iTunesApp, selectedTracks, newPlayCount
Dim prompt, title, defaultValue

Set iTunesApp = WScript.CreateObject("iTunes.Application")
Set selectedTracks = iTunesApp.SelectedTracks

prompt = "New playcount:"

For Each IITTrack In selectedTracks
    title = IITTrack.Artist & " - " & IITTrack.Name
    defaultValue = IITTrack.PlayedCount
    newPlayCount = InputBox (prompt, title, defaultValue)

    'MsgBox("NewPlayCount = " & newPlayCount)

    If Len(newPlayCount) > 0 Then
        If IsNumeric(newPlayCount) Then
            If newPlayCount >= 0 Then 
                IITTrack.PlayedCount = newPlayCount
            End If
        End If
    Else
        Exit For
    End If
Next

KaaBAM!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.