A proper foobar2000 submission component

Tags: #<Tag:0x00007f9ad9137650>

Some of you may remember my last effort but it was script based and meant you had to jump through a few hoops to set it up. This is a dedicated component which should be a bit easier…


The readme explains everything (I think).


Thanks a lot. As far as I can tell this is working very well, including the MBID submission. I’m not a foobar2000 user, though, so I just gave it a quick test :smiley:

1 Like

This seems to be working great, thanks for your work.

How about submitting the time zone of the os with the rest of the data?
I believe the api will allow you to put custom fields in the additional_info section and it will be saved in the database.

1 Like

Thanks for trying it out guys.

@dns_server, not really sure how I’d workout the timezone but I could send a localised date/time string in the usual foobar2000 format (YYYY-MM-DD HH::MM:SS)

edit: just tested it out and it works fine. Obviously the field name isn’t fixed - that could be changed.

1 Like

3 posts were split to a new topic: Client identifiers in listen data

Is there a way in foobar2000 to also get the timezone offset? That is, can you format the string as YYYY-MM-DD HH::MM:SS+ZZ? This would make it easier to get the offset by reading the +ZZ or -ZZ instead of subtracting local_time from listened_at.

Looking at your example code, I have a few comments:

  • you submit a listened_at_iso - is this something that you added? I don’t see that we report it in the documentation as a suggested field. I do agree that it’s a good field to include.
  • I see that the format of listened_at_iso and local_time is different. The listened_at has T between date/time and has a timezone (Z) at the end
  • local_time and listened_at are off by 1 second. Perhaps this is because as you fill in each field you get the current time again. I don’t know foobar2k scripting - can you get the date once and use that value to format each field?
1 Like

That has nothing to do with me. It’s very much part of the ListenBrainz server setup.


As for the rounding error, foobar2000 usually deals in windows file time stamps and I used methods from the foobar2000 SDK to work with them…

// number of 100-nanosecond intervals since January 1, 1601 UTC.
uint64_t now = pfc::fileTimeNow(); 

// windows to unix timestamp converter (number of seconds since Jan 1, 1970 UTC)
uint64_t unix_ts = pfc::fileTimeWtoU(now); 

// windows timestamp to local date string
pfc::string8_fast str = format_filetimestamp(now); 

Clearly there is a difference in how they’re rounded so next time I’ll use the unix timestamp as a base and convert that back to windows timestamp losing all the nanosecond precision and then the date strings should line up.

1 Like

Using it now, it works fine for me :slight_smile:

Thanks !!

Ah, sorry. I thought it was something that you added to the payload, but I see that you’re showing the contents of the API output of the LB server, which adds it (based on listened_at) and outputs it in addition to the other fields. :+1:

1 Like

v1.1.0-Beta.1 has been released.


CHG: Now requires foobar2000 v1.5 Beta 18 or later. This is because it now
     uses the fb2k http client which respects the main networking preferences.
     It uses new functionality that is not available in earlier versions.
NEW: Add caching support which will retry failed submissions at a later time.
     Not guaranteed to be bulletproof. I would like some feedback from testers

If anyone is using the Beta from the post above, I realise it’s spitting out some ugly html source in the Console due to the ListenBrainz downtime at the moment. It will fixed in the next version where it’s much tidier…

Opening track for playback: "E:\Music\Albums\AAC\My Brightest Diamond\A Million And One\10. White Noise.m4a"
ListenBrainz 2: HTTP/1.1 503 Service Temporarily Unavailable
ListenBrainz 2: The cache now contains 9 listen(s)
Opening track for playback: "E:\Music\Albums\FLAC\Massive Attack\Protection\01. Protection.flac"
ListenBrainz 2: HTTP/1.1 503 Service Temporarily Unavailable
ListenBrainz 2: The cache now contains 10 listen(s)

v1.1.0-Beta.2 is out


CHG: Improve the way errors are reported when ListenBrainz is down.
CHG: Send more additional tags. See the main readme for a full list.

I’m a bit more confident about the caching feature given that it was put to the test by ListenBrainz being down yesterday. It worked exactly as I’d hoped. It’s easy enough to test servers not being reachable but dealing with the response of a placeholder page helped me improve things.


v1.1.0 is out.


I’ve added the daftest feature that I’ll never use and nobody asked for but you can now set a query to skip submitting tracks. You’d only do this if you were secretly ashamed of something you were listening to and didn’t want to share it with the world. It uses the foobar2000 query syntax documented here…


You’ll find the option in the Preferences… :stuck_out_tongue: