Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support standalone Bandcamp tracks #7

Merged
merged 5 commits into from
May 28, 2024

Conversation

mwiencek
Copy link
Contributor

@mwiencek mwiencek commented May 28, 2024

Some /track/ URLs on Bandcamp represent singles (often with their own cover art) that aren't otherwise released as part of an album.

It seems you can distinguish these from album tracks by checking TrAlbumCurrent.album_id, which is null for tracks without an associated album. (Perhaps there is another, more obvious way that I missed.)

In the second commit, I was able to extract an ISRC for these tracks where available. (Apparently Bandcamp only embeds ISRCs on track pages, not album pages?)

This is probably very hacky since I was still trying to wrap my head around the codebase, but I'm happy to improve it.

A few URLs I tested with:

throw new ProviderError(this.provider.name, `${specifier} is not a release URL`);
}
this.lookup = { method: 'id', value: entity.id };
this.id = entity.id;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assigned the id here so that I could access it in getRawRelease. Is the assignment in convertRawRelease still needed?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, no idea why I haven't made this assignment in the constructor right from the start 😇
Looks like this is worth to be changed in all provider implementations.

@mwiencek mwiencek force-pushed the bandcamp-track branch 2 times, most recently from a9a1c11 to 6f4dead Compare May 28, 2024 01:50
Copy link
Owner

@kellnerd kellnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I am surprised how few changes are necessary to support seeding releases for track pages as well.

providers/Bandcamp/mod.ts Outdated Show resolved Hide resolved
throw new ProviderError(this.provider.name, `${specifier} is not a release URL`);
}
this.lookup = { method: 'id', value: entity.id };
this.id = entity.id;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, no idea why I haven't made this assignment in the constructor right from the start 😇
Looks like this is worth to be changed in all provider implementations.

providers/Bandcamp/mod.ts Outdated Show resolved Hide resolved
providers/Bandcamp/mod.ts Outdated Show resolved Hide resolved
providers/Bandcamp/mod.ts Outdated Show resolved Hide resolved
@mwiencek mwiencek force-pushed the bandcamp-track branch 2 times, most recently from bea9be8 to 3c799be Compare May 28, 2024 19:36
Copy link
Owner

@kellnerd kellnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a final round of minor nitpicks 🧐

providers/Bandcamp/mod.ts Outdated Show resolved Hide resolved
providers/Bandcamp/mod.ts Outdated Show resolved Hide resolved
providers/Bandcamp/mod.ts Outdated Show resolved Hide resolved
providers/base.ts Outdated Show resolved Hide resolved
mwiencek and others added 5 commits May 28, 2024 16:23
Some `/track/` URLs on Bandcamp represent singles (often with their own cover
art) that aren't otherwise released as part of an album.

It seems you can distinguish these from album tracks by checking
`TrAlbumCurrent.album_id`, which is `null` for tracks without an associated
album. (Perhaps there is another, more obvious way that I missed.)
Bandcamp `/track/` URLs may include an ISRC in `TrAlbumCurrent`.
Handle `null` and missing values for release date, GTIN and track number.
The original thought was not to seed edit notes with localhost URLs, but
this can also happen with a local production server, not only with a
development server.
It is rather useful being able to check the permalinks in development.
@kellnerd kellnerd merged commit 194a833 into kellnerd:main May 28, 2024
@mwiencek mwiencek deleted the bandcamp-track branch May 28, 2024 21:35
@kellnerd kellnerd mentioned this pull request May 29, 2024
@kellnerd kellnerd added feature New feature or request provider Metadata provider Bandcamp and removed provider Metadata provider labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bandcamp feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants