beets icon indicating copy to clipboard operation
beets copied to clipboard

spotify: Handle API failures

Open 9999years opened this issue 5 months ago • 5 comments

Lots of these weren't handled, leading to crashes while importing.

To Do

  • [ ] Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • [ ] Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • [ ] Tests. (Very much encouraged but not strictly required.)

9999years avatar Jul 31 '25 23:07 9999years

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

github-actions[bot] avatar Jul 31 '25 23:07 github-actions[bot]

Codecov Report

:x: Patch coverage is 18.51852% with 22 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 63.67%. Comparing base (5beb3d1) to head (55b3e45).

Files with missing lines Patch % Lines
beetsplug/spotify.py 18.51% 21 Missing and 1 partial :warning:
:rocket: New features to boost your workflow:
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jul 31 '25 23:07 codecov[bot]

Maybe it is worth taking a step back here:

How do we want to handle errors in metadata plugins in general? E.g. what should happen if one plugin fails because a remote service is currently unreachable? Do we want beets to crash here or just warn a user?

I think raising errors in the specific metadata plugin (such as spotify or deezer) is completely fine. We should handle errors globally for any metadata plugins tho and warn users.

Proposal: Let's add error handling to the metadata_plugins.py file and warn the user that some plugin(s) did not complete a lookup or function call successfully. This would also move responsibilities away from the plugin developers and reduce unnecessary & duplicate error handling.

semohr avatar Aug 02 '25 18:08 semohr

@9999years Are you planning to keep looking into the metadataplugin layer for adding error handling? If you want to take the lead on it, go ahead. I’d be glad to chime in or help out later, since it’s also needed for the aisauce plugin. From what I can tell it shouldn’t be too difficult to add.

semohr avatar Aug 22 '25 09:08 semohr

@semohr Feel free, I might get back to this in the future but I'm not sure when.

9999years avatar Aug 22 '25 18:08 9999years