Skip to content

Playcount 2003#



foobar2000 2.1 or later. 32bit and 64bit are both supported.


This component uses the same database backend that foo_playcount utilises for logging plays but has many more advanced features and fewer limitations.

  • Playcounts and dates can edited for any context menu selection.
  • Data can be imported from file tags or fields provided by other components.
  • The current time is available via title formatting as a full date time string or Unix timestamp.
  • First played, last played and added are all available as Unix timestamps.
  • How records are bound to tracks can be configured in the Advanced Preferences.

Advanced Preferences#

The first thing you'll want to do after installing this is check File>Preferences>Advanced>Tools>Playcount 2003.

playcount preferences

It's important that the main pattern and Simple or Advanced mode are decided on before starting as any change causes immediate data loss. foobar2000 will prompt you to restart when changing any setting.

Title format pattern#

This is how database records are bound to your tracks. The default of %path%|%subsong% does mean every track will have unique data.


As of 0.1-Beta.6, statistics can survive files being moved or copied when using file operations. Cuesheets/other tracks with multiple chapters are not supported. If that is not acceptable, you should change it to a pattern that makes use of tags instead. You might consider a pattern like

%album artist%|%album%|%date%|%discnumber%|%tracknumber%|%title%

Log track as played#


This is only available in component version 0.2 and later. These settings can be changed at anytime.

The default is to use the same internal method as foo_playcount. This means you have to listen to at least 1 minute for it to count. You have to listen to the whole track if it's shorter.

Now you can customise the time in seconds by entering a number or making it dynamic by using title formatting. If the title format pattern does not evaluate to a number, the track won't be logged.

You must take care to cover every scenario because there is no safety net. For example if you enter 30, no track shorter than that will ever count.

Therefore you should consider using %length_seconds%.


Half the track length or 30 seconds, whichever is lower.
The whole track


For this last example, you cannot use %length_seconds% on its own because lengths may be rounded up and the counter will never reach it.

Data retention#

Database records are remembered for 4 weeks when not monitored as part of the Media Library or any loaded playlist. This behaviour is the same as foo_playcount.

Available fields#

These fields are available globally in foobar2000 in any playlist columns/search/3rd party panel.

Full date/time strings
Unix timestamps (number of seconds since 1st January 1970)
Calculated difference since now, formatted in weeks, days, hours, minutes, seconds
Calculated difference since now, formatted in years and months. Weeks and days are only shown if less than one year


Added: %2003_added%
Added ago: %2003_added_ago%
Added ago2: %2003_added_ago2%
First: %2003_first_played%
First ago: %2003_first_played_ago%
First ago2: %2003_first_played_ago2% 
Last: %2003_last_played%
Last ago: %2003_last_played_ago%
Last ago2: %2003_last_played_ago2%
Plays: %2003_playcount%
Loved: %2003_loved%
Rating: %2003_rating%

text display

Ratings and loved values are set via the context menu for any playlist/library selection.


Added times are generated automatically for Media Library items only. This happens when foobar2000 starts or when new library items are added. If you clear data via the context menu, the Added field will remain empty until the next restart or the next play or import.

Added dates can be edited via the context menu. Selecting this option will open an edit dialog where you can update it using any valid date/time string in YYYY-MM-DD HH:MM:SS format. The component will not check if selection items belong to the library when writing.


Strictly speaking, the earliest supported date/time is 1970-01-01 00:00:01. As Unix timestamps are used internally, zero is reserved for indicating not set. The latest value is some time in the year 2106 because 32bit unsigned integers are used for storage.

Data import / export#

You can import/export data either via the main menu > Library>Playcount 2003 or use the context menu on any playlist/library selection. When importing, files must be UTF8. With or without BOM is fine. Exported files are always without BOM.

Command line support#

You can import JSON files via the command line like this:

.\foobar2000.exe /playcount_2003_import:filename.json

The file path must be relative to the user profile folder.

Simple mode#

The main Edit dialog found under the context menu > Playcount 2003>Edit now supports Presets and you can import data from foo_playcount or foo_lastfm_playcount_sync as illustrated here:

playcount edit dialog

In addition to Presets, you can fill in values manually or use title formatting to import data from tags/other components.

Advanced mode#

Advanced mode exclusive fields

%2003_timestamps% is a stringified array of timestamps and this tracks every single play as you listen. This functionality originated in foo_enhanced_playcount. JavaScript component users can use JSON.parse to manipulate it.

The playcount/first played/last played values are extrapolated from the contents of this array so editing via the context menu is not supported.

%2003_playcount_this_year% / %2003_playcount_last_year% aggregate plays for the given years.

Working with JScript Panel 3#


With minor adjustments, this could work with any scripting component. They all provide the same functionality.

Since first played/last played/playcounts are not editable in Advanced mode, you can generate your own JSON files to import. Using the exact same title format pattern from the Advanced preferences, you can generate an id for each entry like this:

var items = plman.GetPlaylistItems(plman.ActivePlaylist);
var tfo_id = fb.TitleFormat("%path%|%subsong%");
var arr = [];

for (var i = 0; i < items.Count; i++) {
    var item = items.GetItem(i);
    var obj = {
        "id" = tfo_id.EvalWithMetadb(item),
        // empty array on purpose, scripters should know what to do!
        // must be Unix timestamps (seconds, not milliseconds)
        "2003_timestamps" : [],
var str = JSON.stringify(arr);
// save to file



  • You can now configure how much you have to listen to a track before it counts as a play. The default using the same rules as foo_playcount remains unchanged. See here.


  • Fix Edit dialog text truncation and crash bugs.


  • The Edit dialog now supports dates in YYYY-MM-DD format. The time will be set to 00:00:00 automatically.


  • Add workaround for horrible library initialisation bug which prevented library viewers like Album List from populating themselves on startup.


  • Update Edit dialog with Rating field. Although setting the Rating via the context menu was always possible, it wasn't possible to import ratings from foo_playcount. This change allows that.


  • Fix bug where OK button in Edit dialog remained disabled after choosing a history item from the dropdown.
  • Update the file importer in Advanced mode. Previously, any timsestamps that were identical for a given track were discarded. Now the check expands and assumes any timestamps within 10 seconds of each other are duplicates. Just to be clear, this is per track.


  • Add the following fields:

See here


  • Editing values via the context menu now reports how many items were updated in the console.
  • The file importer now accurately reports how many items were updated by only counting when values were modified.


  • Minor file import tweaks.


  • Fix bug with context menu items for marking selections as loved/unloved.


  • Initial release