12

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?

8 Answers 8

16

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.

2
  • 5
    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, 2013 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. Jan 2, 2013 at 21:22
4

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!

0
3

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.

1
  • 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, 2013 at 19:25
1

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!

1
  • 2
    I'd just like to add that this method deleted the music I had added from my apple music subscription. Mar 14, 2018 at 22:45
1

Microsoft has announced they'll retire VBScript. So here's @Syclone0044 solution rewritten in PowerShell:

$itunesApp = New-Object -ComObject iTunes.Application
$selectedTracks = $itunesApp.SelectedTracks

foreach ($track in $selectedTracks) {
  $title = $track.Artist + " - " + $track.Name
  $playedCount = $track.PlayedCount
  $result = Read-Host -Prompt "New playcount for $title (current: $playedCount)"
  if ($result.Length -gt 0) {
    $playCount = $result -as [int]
    if ($playCount -ne $null -and $playCount -ge 0) {
      Write-Output "    ... will be updated to: $playCount"
      $track.PlayedCount = $playCount
    }
  }
}
0

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

0

Ultraduty super power solution;

Set play time to one second, click play in itunes on the the file as many times as needed.

WhaBAM.

0

For Windows you can either use the scripts from http://liquidparallax.com/2007/06/09/windows-itunes-scripts-downloads/

Or I wrote an updated version with a dialogue box available at http://zagz.com/update-play-count-itunes-windows/ Chrome won't let you download the script as it is a zipped windows script file so use Firefox or something else to get it.

You must log in to answer this question.

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