Foobar2000:Components/Playback Statistics v3.x (foo playcount)
From Hydrogenaudio Knowledgebase
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
 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.
 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.
 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.
 Title formatting fields
- %first_played% - date/time at which the song was played for the first time.
- %last_played% - date/time at which the song was played last time.
- %play_count% - how many times the song has been played.
- %played_per_day% - estimate how many times per day the song has been played, based on time first played, time last played and times played.
- %added% - date/time at which the song was added to the Media Library.
- %rating% - song's rating, on a 1..5 scale.
- %rating_stars% - song's rating, formatted as up to five stars, e.g. ★★★
- %rating_stars_fixed% - song's rating, formatted as five stars, e.g. ★★★☆☆
Note that 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.
 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.
foobar2000 v1.1 or newer is required, beta versions included.