Skip to content

discogs_importer: subtracks in Discogs to separete tracks in Musicbrainz#281

Open
hirokobayashi wants to merge 8 commits into
murdos:masterfrom
hirokobayashi:master
Open

discogs_importer: subtracks in Discogs to separete tracks in Musicbrainz#281
hirokobayashi wants to merge 8 commits into
murdos:masterfrom
hirokobayashi:master

Conversation

@hirokobayashi

Copy link
Copy Markdown

Hi
I modified Discogs importer to generate separate tracks for Discogs subtracks instead of merging them to one track in musicbrainz.
The track format will be "trackname: subtrackname" which would match the classical music guideline.

@hirokobayashi hirokobayashi changed the title discogs_importer: subtracks in Discogs to separete tracks in Musicbrainz discogs_importer: subtracks in Discogs to separete tracks in Musicbrainz Jun 19, 2020
@jesus2099

Copy link
Copy Markdown
Contributor

Hello @hirokobayashi,
But MusicBrainz is supposed to represent the CD faithfully, without adding fictitious tracks, isn't it?

@hirokobayashi

Copy link
Copy Markdown
Author

Hello @hirokobayashi,
But MusicBrainz is supposed to represent the CD faithfully, without adding fictitious tracks, isn't it?

This commit fixes #138

Please check the discogs document about track and heading here.
https://support.discogs.com/hc/en-us/articles/360005055373-Database-Guidelines-12-Tracklisting#Index_Tracks_And_Headings

Original discogs importer uses a heading as a track and subsequent tracks are merged into the heading.

@jesus2099

Copy link
Copy Markdown
Contributor

Oh thanks, in fact you already found a doc about the distinction between indeed tracks (that are 1 CD track) and headings (CD track set, logical group of several CD tracks).

I would like to test your patch with the two cases and come back here afterwards. ☺️

@ke4roh

ke4roh commented May 17, 2021

Copy link
Copy Markdown

I've run into the bug this fixes. Here's a vote for merge!

@kaysond

kaysond commented May 15, 2022

Copy link
Copy Markdown

Please merge this!

@kaysond

kaysond commented May 15, 2022

Copy link
Copy Markdown

Pinging @jesus2099 @murdos @Schweinepriester @kellnerd

I'm happy to rebase this if someone will commit to merging it in the next week.

@kaysond

kaysond commented May 23, 2022

Copy link
Copy Markdown

I've fixed this for classical albums in a really hacked together fork here: https://github.com/kaysond/musicbrainz-userscripts/blob/discogs-classical/discogs_importer.user.js

@jesus2099

jesus2099 commented May 23, 2022

Copy link
Copy Markdown
Contributor

Oh, is that patch to old now?
I think Discogs had recently changed their pages.

Sorry @hirokobayashi, only now I took time to test it:

I first tested this 2CD release from this post .
It works good with latest version of the script, splitting it in 2 mediums.
But this PR patched script does not load at all on the Discogs page.

@kaysond, is that what you meant by rebasing?
Redo this patch but in the latest importer version?

Next tests will be this single track with indexes release from this other post.

@jesus2099

jesus2099 commented May 23, 2022

Copy link
Copy Markdown
Contributor

Wow!
It seems better!

Discogs release Current importer @hirokobayashi + @kaysond version
2017-02-19: trackset 🔴 🟢
2017-02-21: strange LP bugged tracklist what is expected? different, I find it better, but what is expected?
2017-02-21: multi disc tracksets 🔴 🟢
2020-05-10: single split track 🔴 🟢
2020-06-06: complex multi-disc tracksets 🔴 🟢
2020-12-17: A/B LP 🟢 🟢
2020-12-17: CD+CD+DVD 🔴 🔴
2020-12-27: A/B+C/D with bad? subtracks 🔴 🔴
2020-12-27: A/B+C/D with good? subtracks 🔴 🔴
2020-12-27: split track on second CD 🔴 🔴

(I will update this table with more tests)

Wow, it must be so difficult to manage all the cases.

@kaysond

kaysond commented May 23, 2022

Copy link
Copy Markdown

@jesus2099 - correct. This PR is based on a very old discogs import script. Mine was based on the latest one, but its not very good code!

@jesus2099

jesus2099 commented May 23, 2026

Copy link
Copy Markdown
Contributor

I don't know why and what, but there have been more recent PR merged to this script, since then.
This PR seemed like a progress.
Is there a volunteer to re-benchmark this PR vs current version?
It's not supposed to fix all Discogs tracklist mistakes, but to turn some 🔴 red lights into 🟢 green lights, like it already did, back in 2020 and then 2022!

And then we ask some admins to merge this quickly, to avoid wasting more time benchmarking later again.

@jesus2099

Copy link
Copy Markdown
Contributor

@hirokobayashi could you check out this possible typo:

https://github.com/hirokobayashi/musicbrainz-userscripts/blob/291b654de031b66a2611073a4f862c8d8cfe6f96/discogs_importer.user.js#L716

Shouldn't it be track_new.duration instead of track_new.duraction?
In which case, please fix, and this PR will be even better! :)

@hirokobayashi

Copy link
Copy Markdown
Author

@jesus2099 Thank you for review. I fixed the typo.

@arsinclair

Copy link
Copy Markdown
Collaborator

I was going to look at it last week, but didn't find the time. Hopefully next weekend, then.

I was wondering if you can think about some ways to create automated tests for this, since with so many different ways to write things on Discogs our logic might break any time. Ideally, some way to snapshot all Discogs pages in question and run the script on top of the snapshot.

Maybe not to implement it yet, not within this PR, but just to brainstorm how it can be done.

@hirokobayashi

Copy link
Copy Markdown
Author

The function "parseDiscogsRelease" in "discogs_importer.user.js" parse a json from Discogs and generate a json for Musicbrainz.
So you can test it has regression, as long as if you keep the input json and expected output.

I made a script to test it. But I don't know where to put it in this repo. So I'll attach it as a file.
How to use the script

# get a Discogs track file as json
curl https://api.discogs.com/releases/1996829 > trackset.json
# generate expected result
node test.js trackset.json > trackset-expected.json
# compare the latest result with expected result
node test.js trackset.json trackset-expected.json

I expect test.js is in the same directory of discogs_importer.user.js

I add a mod to export the "parseDiscogsRelease" function to use from test file.

test.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants