Foobar2000:Components/Playback Statistics v3.x (foo playcount)

From Hydrogenaudio Knowledgebase
Playback Statistics

Developer(s) Peter Pawlowski
Release information
Initial release 2006
Stable release 3.1.5 (March 15, 2023)
Preview release
foobar2000 compatibility
Architecture {{{foobar2000_architecture}}}
Minimum version 1.6
Maximum version
UI module(s) Default UI; Columns UI
Additional information
Use Playback statistics
Discussion thread {{{discussion_thread}}}
View all components


This component collects and maintains statistics for played songs.


The statistics include:

  • Time/date first played
  • Time/date last played
  • Playback count
  • Time/date added to the Media Library
  • Rating

New playback statistics data pinning scheme introduced in version 3.0

Playback statistics are now pinned to a combination of artist + album + disc number + track number + track title information, contrary to pre-3.0 versions which would pin data to file paths.

The consequences of this behavior are:

  • Statistics are shared between redundant copies of the same tracks - useful when you keep separate copies of your music in different formats such as lossy + lossless.
  • Automatic carrying over of statistics when acquiring the same music in another format, as long as tags match.
  • No risk of data loss when moving files around or between computers.

When editing tags, affected playback statistics records are transferred accordingly.

Starting from version 3.0, collection of playback statistics is no longer restricted to your Media Library content. You can use this component without using Media Library at all, however, you should keep your non-ML music referenced from a playlist for foobar2000 to maintain the statistics.

Playback statistics data is no longer dropped when the tracks are removed from the media library. A record gets removed when no matching track has been seen by foobar2000 (in Media Library or in any playlist or in an imported XML backup of playback statistics) for four weeks.

Title formatting fields

Date/time at which the song was played for the first time.
Date/time at which the song was played last time.
How many times the song has been played.
Estimate how many times per day the song has been played, based on time first played, time last played and times played.
Date/time at which the song was added to the Media Library.
Song's rating, on a 1–5 scale.
Song's rating, formatted as up to five stars, e.g. ★★★
Song's rating, formatted as five stars, e.g. ★★★☆☆

Note: You may need to change your fonts for the stars-formatting fields to produce readable output.

Detailed information about Title formatting for Playback Statistics can be found here.

XML backup functionality

You can export playback statistics to an XML file and import them later, through Library => Playback Statistics menu commands, or through context menu on specific tracks. This can be used to easily transfer playback statistics between different foobar2000 installations or profiles.

Backwards compatibility

As with all previous releases, this component is fully backwards compatible with databases created by any versions released publicly before. If you have used an earlier version of the Playback Statistics component before, your existing data will be automatically imported on first run.

If you wish to keep the ability to revert to an older 2.x version, please back up your PlaybackStatistics.dat file before running the new component first time.

Common sources of confusion

Please note that foo_playcount takes over %RATING%, %PLAY_COUNT%, and all other mappings corresponding to its native fields listed above, using these mappings to return the fields from its own database rather than from files themselves. If you want to display such fields from the tags of files rather than from the database, use $meta(rating) and so on in your title-formatting. This behavior has changed in version 3.0: previous versions would fall back to reading the field from the file's tags when the corresponding field was not present in the database.

It is important to note that the component cannot retrieve data from before it was installed; therefore, it initializes statistics when it is installed. Most uses of the %ADDED% field, for example, will at first return the entire media library; this is because foo_playcount has no way of guessing when the files were actually added because it was not present at the time. Thus, the default value of %ADDED% is set to the time that the component was first loaded. Any items added after foo_playcount is installed will have the field set properly because it is present to detect them.

External links