Submit your "listens" with foobar2000

foobar2000
Tags: #<Tag:0x00007f23c6ba3308>

#1

This isn’t a dedicated component but rather a script and you’ll need to follow this guide to install the component it requires first.

https://github.com/19379/foo-jscript-panel/wiki/Requirements-&-Installation

In the section about samples, there is one included in the complete folder named listenbrainz.txt so just paste the code from that in to a panel, read the note about adding your listenbrainz token and you’re good to go. There are a couple of other options to look at when clicking the button as well.

It obeys the same rules as last.fm so you have to listen to at least half the track - or 4 minutes - whichever comes sooner. All activity can be viewed via the foobar2000 Console (found on the view menu).

If present, the script submits various musicbrainz IDs contained within your files as documented towards the bottom of this page.

https://listenbrainz.readthedocs.io/en/production/dev/json.html#submission-json

Note that foobar itself does not support id3v2/UFID tags so it can’t submit those. As an alternative, you may tag your files with a recording ID in the musicbrainz track id or musicbrainz_trackid TXXX frames. Scroll down to post 20 for a quick Picard script that can copy values. I can’t post a direct link as the forum does this stupid preview box which I despise!!

Please make sure you have the latest version. You can check under File>Preferences>Components>JScript Panel or use Help>Check for updated components.

Changes:
v1.2.3.1 First version with listenbrainz script included

v1.2.3.2 Fix for musicbrainz track id not being submitted from m4a files. It’s also now supported as a TXXX frame for files tagged with id3v2 tags.

v1.2.3.3 Caching/retry support has been added but I’m very much a noob so report any issues if you encounter them! Also please report any code 400 errors you see in the Console as the script will need updating before these tracks can be submitted successfully.

v1.2.4 You can now toggle the script on/off via the button menu. (The bigger version bump is for other component/script changes, not just this!!)

Full changelog/download

https://github.com/19379/foo-jscript-panel/releases


Web scrobbler for browser listening?
List of native ListenBrainz API apps and in development apps
List of native ListenBrainz API apps and in development apps
#2

Yay, thanks! I’ve been waiting for something like this. I assume there’s enough support in MessyBrainz to compensate for not being able to submit recording IDs with MP3s?


#3

I have no idea how messybrainz works but the IDs are available in the exported data so it should be something you can test. FWIW, foobar does support musicbrainz_trackid if written as TXXX.


#4

Does the requirement of the jscript panel mean that I need to have a panel in my UI somewhere just to use the script? Or can it run somewhere in the background?


#5

Columns UI users can hide it by using the Hidden checkbox on the Layout tab in the preferences.

Default UI users can minimise the size so it’s barely visible. First right click>Background>Splitter. Then right click>Configure and comment out this line of code on line 30

//buttons.paint(gr);

Now drag the splitter down and minimise as far as you can go and with Layout editing mode enabled, you can lock it in size like this…


Click the image to view full size


#6

Cool. I’m using ColumnsUI but I didn’t know I could hide panels.


#7

To give an update on the recording ID question, compare the first two listens on my profile. The first was a FLAC, the second an MP3, and both files have the full complement of ID fields. It doesn’t look like MessyBrainz was able to get the recording ID from the track, or anything. A bit unfortunate, but sounds like the only possible fix would be making MeB smarter or linking LB to it more closely, and I have no idea what the code of either looks like to say which is needed. Really enjoying the script so far, though! Now I just need to see what it would take to link to the MusicBrainz rating system…


#8

Maybe someone can make a script for Picard to write recording IDs to TXXX frames if id3 is used, and the ListenBrainz script can be updated to look for the TXXX frame if the UFID tag isn’t found?

It might also be possible to convince the foobar devs to support the UFID tag of course.


#9

Well I don’t understand Picard at all. There’s simply no reason for the UFID tag to ever have been used. It’s a plain text name and value just like all other TXXX frames. Like I mentioned above, if you use TXXX:musicbrainz_trackid, the script will submit them. The album I’m listening to right now is mp3 and you can see the track listing on the webpage has a clickable link because a recording ID was submitted…


#10

Well, according to the id3v2.4 spec, the purpose of the UFID tag is to: “be able to identify the audio file in a database, that may provide more information relevant to the content.” So I think it made sense initially. But nowadays MusicBrainz has a lot of similar identifiers, which are stored in a TXXX frame, so it would be more consistent to use TXXX for all of them.

Pinging @Sophist and @samj1912


#11

UFID is also in id3v2.3.

I don’t actually like the UFID definition - where the Owner Identifier field is supposed to be used for an email address or a web page containing an email address that people can used to email questions about the database. (Any volunteers for handling the millions of emails that this might generate?? :wink: )

However, if we ignore that and use the Owner Identifier field for either the MuB home page or a file-specific URL, then there is no reason why Picard shouldn’t read/write/populate the UFID tag.

I would put the Owner Identifier as either the MuB home page or the URL to the Release / Recording web page, and the identifier as the Track / Recording MBID (not sure which of these options would be best).

The other question is whether we should overwrite an existing UFID tag if it holds information for a database other than MB (given that we already have the TXXX fields as the primary indexes into our database) - my gut reaction would be to add support in Picard for reading/writing UFID, and use one of two plugins to populate it - one plugin to populate it regardless of existing contents, the other to populate it only if it doesn’t have a different database already.


#12

But right now Picard doesn’t seem to write the MusicBrainz Recording ID tag to a TXXX field, because that tag isn’t visible in foobar2000 (so it is probably written to the UFID field). Picard also seems to write the MusicBrainz Track ID to a tag called “MUSICBRAINZ RELEASE TRACK ID” which the ListenBrainz script doesn’t seem to pick up.

MBIDs in foobar2000:

MBIDs in Picard:


#13

musicbrainz release track id can’t be used as it’s the not the recording. If I use mp3tag on an mp3 album tagged with Picard, it shows musicbrainz_trackid (UFID) and musicbrainz release track id which have different values.

Using the musicbrainz release track id on the recording URL simply doesn’t exist…

https://musicbrainz.org/recording/43b3f2ca-5fa7-46ca-9fd6-7d2df3d12fab

whereas musicbrainz_trackid does…

edit: clearly Picard should be showing both of those as separate entities but it’s not my responsibility to explain any of this nonsense!!


#14

That’s because “MusicBrainz Release Track Id” is a track ID, not a recording ID.

You should submit it as “track_mbid” to ListenBrainz.


#15

I already do that.

I hadn’t noticed because none of my tracks contain it. I use foo_musicbrainz for tagging which doesn’t write it.

edit: if people enable this option (it’s off by default)

…they can see the full JSON payload in the Console when it’s sent.


#16

Track MBIDs are more specific than Recording ones and should be submitted as they’re TXXX:MusicBrainz Release Track Id fields. (A Track MBID is a Recording in a specific position on a specific Release, so one Track will always equal exactly one Recording, though one Recording can equal multiple Tracks.)

So MessyBrainz should be able to figure it out if it has a full set of the other MBIDs. Of course, if won’t help much for standalone recordings that do not have a Track MBID, due to not existing on any Releases.


#17

I really, really doubt that it would generate millions of e-mails, and besides, we already have a manned e-mail/contact address for just this purpose:
https://metabrainz.org/contact

According to the tag mapping, Picard should currently use UFID:http://musicbrainz.org for Recording MBIDs. If it doesn’t set this field already, that’s probably a bug.

However, using that field doesn’t mean we can’t also use TXXX:MusicBrainz Recording Id.


#18

Yeah, from everything I’ve seen digging into the files, we do properly set UFID:http://musicbrainz.org. I did a quick search, and it seems like foobar2000 doesn’t have any intention of supporting it, though, because it isn’t a plain text tag. A bit shortsighted in my opinion, but as you said, the track IDs would be more accurate.

My complaint was that ListenBrainz only seems to add a link on the song title if it’s given a recording ID, rather than being able to guess it from the track. It does make some sense – the recording linked to a track may change – but it seems like LB or MeB might give up too quickly.


#19

Right, I’ve discovered my first bug, If you have properly tagged m4a files, my script won’t submit musicbrainz track id tags as specified on the tag mapping page.

I actually think this would be the best bet as an “alternate” for id3v2 as well as it matches the existing naming convention of all the other MBID specific TXXX frames as well. However, if you guys want to list others, I may add them.

edit: An updated version with a fix for the m4a problem has been uploaded. I’ve also updated the first post mentioning that musicbrainz_trackid or musicbrainz track id written as TXXX may be used for files containing id3v2 tags. This is because foobar does not support and isn’t likely to support UFID tags.


#20

Here you go.

$copy(_id3:TXXX:MUSICBRAINZ TRACK ID,musicbrainz_recordingid)

I only tested on one album so you might want to test it on copies a bit more thoroughly.

If you open the file with mp3tag, you should see the new MUSICBRAINZ TRACK ID match the MUSICBRAINZ_TRACKID (which is the UFID frame) like this…

and obviously foobar2000 can now see it…

Latest version of the script is required for this, check the first post for details.