A proper foobar2000 submission component

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…

https://github.com/marc2k3/foo_listenbrainz2

The readme explains everything (I think).

11 Likes

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.

Code search results · GitHub

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.

https://github.com/marc2k3/foo_listenbrainz2/releases

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
     please!!
5 Likes

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)
2 Likes

v1.1.0-Beta.2 is out

https://github.com/marc2k3/foo_listenbrainz2/releases

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.

3 Likes

v1.1.0 is out.

https://github.com/marc2k3/foo_listenbrainz2/releases

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…

https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Query_syntax

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

8 Likes

It looks like the repo for the component is inaccessible. Was it moved somewhere?

Strange, it just had a new release a few days back, see the thread at

@marc2k3 will know more

1 Like

You can get my final versions of all fb2k components here…

https://hydrogenaud.io/index.php?topic=118824.0

3 Likes

So currently it seems like the foo_listenbrainz2 source code has been lost :frowning: Has anybody here a fork? I would love to help restoring this project.

2 Likes

I have preserved the latest source code I could find for foo_listenbrainz2 at https://github.com/phw/foo_listenbrainz2 and set up automatic builds.

As this is based on the 1.0.0 release it lacks the newer features listed above, most important I think the offline caching. Hence I’d recommend everybody to use the binary release available at https://hydrogenaud.io/index.php?topic=118824.0

But it would be a shame to leave this component for dead and loose the source code completely. I’d love to see development for this component revived, but I’m personally neither an active foobar2000 user nor much of a Windows developer. Also I’m pretty occupied by other projects. So for the moment this repository is more there for preservation, but if someone wants to take this up please let me know. Or just submit some pull requests with missing features.

@marc2k3 I have also updated your README file to fit this new repository and code version better, as you suggested in the other thread. Let me know if you would like to see some changes.

2 Likes

Just a small typo in the readme regarding versions. You dabbled with v1.2.0 before going back to 1.0.1. My last release was v1.1.0.

1 Like

If anyone is taking requests, foo_scrobble has an option to enable/disable submission right from the Playback menu. I’d like that very much. :smile:

1 Like