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

discogs: Fix discogs_albumid extraction #4303

Merged
merged 5 commits into from
Mar 4, 2022
Merged

Conversation

JOJ0
Copy link
Member

@JOJ0 JOJ0 commented Mar 1, 2022

Description

To Do

  • Documentation.
  • Changelog.
  • Tests.

JOJ0 added a commit to JOJ0/beets that referenced this pull request Mar 1, 2022
@sampsyo
Copy link
Member

sampsyo commented Mar 1, 2022

Looks good overall, except that a test seems to be failing.

Also, just to check: is extract_release_id now dead code (never called)? If so, we should remove it. ✨ 🐟

@JOJ0
Copy link
Member Author

JOJ0 commented Mar 2, 2022

Hi @sampsyo
test.test_discogs.DGAlbumInfoTest.test_parse_minimal_release was failing because the test data does not contain a Discogs URL and the regex check wanted to test against a None value.

extract_release_id() had a check whether an URI was passed at all and returned None immediately if not. I added such a check to extract_release_id_regex() as well.

Copy link
Member

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

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

Ah, thanks for tracking down the failing test!

I made a silly suggestion within, but maybe the better fix would actually be to just fix the test so it actually includes an ID? (Unless we expect the API to ever return a response without a URL, which I doubt…)

beetsplug/discogs.py Outdated Show resolved Hide resolved
JOJ0 added 5 commits March 4, 2022 08:17
Use extract_release_id_regex instead of extract_release_id to get the
release ID out ouf the Discogs release URL.
Check whether any input worth pattern checking was passed.
This reverts commit c3cc055.

We assume the Discogs API never returns a release response without an
URI.
@JOJ0
Copy link
Member Author

JOJ0 commented Mar 4, 2022

Thanks for the review! Added URI to test data, removed sanity check in extract_release_id_regex() and "rebased-in" upstream master.

Copy link
Member

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

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

Yay; looks great!!

@sampsyo sampsyo merged commit 80a86c6 into beetbox:master Mar 4, 2022
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.

discogs: discogs_albumid is always 0
2 participants