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

Fix email download being seen as free if price is added after upload #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Brisppy
Copy link
Contributor

@Brisppy Brisppy commented Dec 7, 2023

Encountered an issue with email downloads if a price is set after the release was uploaded as free.

The email download would process as if it was available before halting with ValueError: Email download request failed: {"ok":false,"error":"Sorry, this item is no longer available for free."}

This change checks that the minimum_price is 0. I'm not sure if tracks and non-email downloads have this issue but I added the check for all types just in case.

Force-pushes were to cover potential edge cases I forgot and cover both albums and tracks all in one

@yyyyyyyan
Copy link
Owner

@Brisppy Can you send me an example of release which results in that?

@Brisppy
Copy link
Contributor Author

Brisppy commented Dec 7, 2023

Sorry forgot to include that, this one should throw it https://girlfriendrecords.bandcamp.com/album/phases.

[?] Searching available downloads for URL https://girlfriendrecords.bandcamp.com/album/phases
[+] Email download found! Downloading Linkydubs - Phases
Traceback (most recent call last):
  File "/usr/local/bin/bandcamper", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/bandcamper/__main__.py", line 169, in main
    bandcamp_downloader.download_all(destination, output, output_extra, *audio_formats)
  File "/usr/local/lib/python3.6/dist-packages/bandcamper/bandcamper.py", line 352, in download_all
    url, destination, output, output_extra, *download_formats
  File "/usr/local/lib/python3.6/dist-packages/bandcamper/bandcamper.py", line 303, in download_from_url
    url, music_data["id"], music_data["item_type"]
  File "/usr/local/lib/python3.6/dist-packages/bandcamper/bandcamper.py", line 228, in _get_download_url_from_email
    raise ValueError(f"Email download request failed: {response.text}")
ValueError: Email download request failed: {"ok":false,"error":"Sorry, this item is no longer available for free."}

@Brisppy
Copy link
Contributor Author

Brisppy commented Dec 8, 2023

Encountered an issue with this album where it would enter the if not music_data["current"].get("minimum_price"): block as it has no minimum_price, but failed both of the inner checks resulting in no download and a NameError as file_paths would be undefined - now fixed with 5384248.

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.

2 participants