Set audio format on Bandcamp track ProviderMapping (#3213)
authorDavid Bishop <teancom@users.noreply.github.com>
Thu, 26 Feb 2026 07:58:26 +0000 (23:58 -0800)
committerGitHub <noreply@github.com>
Thu, 26 Feb 2026 07:58:26 +0000 (08:58 +0100)
commitd93e4df5685dc5b56f87553604c94a886dcd6849
treeb6e1771921240bff6ad7f756ec51c29a71c2917c
parent92b87d2d81cb2861568b262e02fefd09a5a7fd4b
Set audio format on Bandcamp track ProviderMapping (#3213)

* Set audio format and fetch fresh streaming URLs for Bandcamp

Extract _fetch_api_track from get_track so get_stream_details can
bypass the 30-day cache and always retrieve a fresh streaming URL.
Set AudioFormat (content_type, bit_rate) on both StreamDetails and
ProviderMapping instead of stashing the URL in metadata.links.

Also: guard split_id against malformed IDs, handle
BandcampMustBeLoggedInError explicitly, and fix album_from_api
for albums with no release_date.

Tests cover _fetch_api_track paths, streaming URL priority/format
selection, library async generators, split_id validation, and
error mapping.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix Bandcamp provider for unauthenticated use

- Remove early return in search() that required identity token;
  the Bandcamp search API works without authentication.
- Handle non-integer media IDs in genre lookup gracefully; provider-
  only items (e.g. Bandcamp compound IDs) can't have genre mappings
  so return an empty list instead of crashing with ValueError.
- Update comment to reflect that unauthenticated mode supports both
  search and streaming, not just search.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------

Co-authored-by: David Bishop <git@gnuconsulting.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
music_assistant/controllers/media/genres.py
music_assistant/providers/bandcamp/__init__.py
music_assistant/providers/bandcamp/converters.py
tests/core/test_genres.py
tests/providers/bandcamp/test_converters.py
tests/providers/bandcamp/test_provider.py