Skip to content

Conversation

@photovoltex
Copy link
Member

@photovoltex photovoltex commented Nov 6, 2025

As noticed by @michaelherger in #1621 the metadata endpoint seems to be broken again and does not contain anymore the file data.

This changes uses the extended metadata endpoint instead, which currently still contains that data.

Fixes #1623, Fixes #1620

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors metadata retrieval to use the extended metadata API endpoint instead of the legacy metadata endpoint, fixing an issue where metadata didn't include audio files.

  • Replaced the legacy /metadata/4/{scope}/{id} endpoint with the /extended-metadata/v0/extended-metadata endpoint
  • Updated all metadata methods to accept &SpotifyUri instead of &SpotifyId
  • Removed the SPCLIENT_FALLBACK_ENDPOINT constant that was previously needed for the legacy endpoint

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
metadata/src/track.rs Updated to pass full SpotifyUri to get_track_metadata instead of extracting the ID
metadata/src/show.rs Updated to pass full SpotifyUri to get_show_metadata instead of extracting the ID
metadata/src/episode.rs Updated to pass full SpotifyUri to get_episode_metadata instead of extracting the ID
metadata/src/artist.rs Updated to pass full SpotifyUri to get_artist_metadata instead of extracting the ID
metadata/src/album.rs Updated to pass full SpotifyUri to get_album_metadata instead of extracting the ID
core/src/spclient.rs Refactored metadata methods to use the extended metadata API, changed signatures to accept &SpotifyUri, and updated get_extended_metadata return type
CHANGELOG.md Documented the breaking changes and bug fix related to metadata retrieval

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hbsagen
Copy link

hbsagen commented Nov 6, 2025

Great, saved my evening. Works nicely!

kingosticks
kingosticks previously approved these changes Nov 6, 2025
@michaelherger
Copy link
Contributor

Working in my 30s of testing.

I'd still get multiple of the following messages per second (in debug mode):

[2025-11-06T19:15:18Z WARN  libmdns::fsm] error sending packet Os { code: 65, kind: HostUnreachable, message: "No route to host" }

@michaelherger
Copy link
Contributor

And works with my fork, too!

@DamianRyse
Copy link

Works pretty good for me.

OneTrueJASH added a commit to OneTrueJASH/spotify-player that referenced this pull request Nov 6, 2025
- Update spotify_id_to_playable_id to use SpotifyUri enum
- Update lyrics method to extract SpotifyId from SpotifyUri

Related: librespot-org/librespot#1622
@OneTrueJASH
Copy link

I can also confirm this fix works as expected. I've successfully tested it with spotify-player v0.21.1.

Since the SpotifyUri API changes were already present in the dev branch (prior to this PR), I first updated spotify-player to be compatible with those changes:

  • Updated functions to use SpotifyUri enum instead of checking SpotifyId.item_type
  • Pattern matching on SpotifyUri variants (Track { id }, Episode { id }) to extract the underlying SpotifyId

With those compatibility changes in place, this PR's metadata endpoint fix works perfectly. Spotify-player now successfully uses the /extended-metadata/v0/extended-metadata endpoint and tracks play without the "Track should be available, but no alternatives found" errors.

I'm preparing a compatibility PR for spotify-player to ensure it's ready when the librespot dev branch changes land in a release.

Thanks @photovoltex!

@photovoltex
Copy link
Member Author

Working in my 30s of testing.

I'd still get multiple of the following messages per second (in debug mode):

[2025-11-06T19:15:18Z WARN  libmdns::fsm] error sending packet Os { code: 65, kind: HostUnreachable, message: "No route to host" }

@michaelherger I don't have such warnings, so this might be something on your end then? But I wont rule out that there is still something we need to fix later down the line.

@OneTrueJASH
Copy link

@michaelherger I don't have such warnings, so this might be something on your end then? But I wont rule out that there is still something we need to fix later down the line.

I also gave this a spin to see if I could reproduce the libmdns warnings @michaelherger mentioned:

RUST_LOG=debug ./target/release/librespot --enable-oauth --name "test-device"
Duration: ~60 seconds
My setup:

  • macOS Tahoe 26.1 (25B78)
  • rustc 1.91.0 / cargo 1.91.0

What I saw:

  • No "error sending packet Os { code: 65, kind: HostUnreachable, message: 'No route to host' }" errors on my end
  • Just the normal libmdns DEBUG libmdns::fsm] received question messages for discovery queries (_spotify-connect._tcp.local, etc.)
  • Everything authenticated and shut down cleanly

So yeah, looks like those warnings are probably specific to certain network setups, as @photovoltex suggested. I couldn't reproduce them here, but thought I'd share just in case it helps!

@michaelherger
Copy link
Contributor

Thanks - I'll see whether I can find something. I'm using PiHole - maybe it's swelling a little too much.

gui-wf added a commit to gui-wf/ncspot that referenced this pull request Nov 7, 2025
- Update Cargo.toml to use librespot from gui-wf fork (photovoltex-fix-broken-metadata branch)
- Add SpotifyUri import to spotify_worker.rs
- Replace SpotifyId::from_uri() with SpotifyUri::from_uri() in load and preload handlers
- Update variable names from 'id' to 'uri' for clarity

This change adapts ncspot to work with librespot PR hrkfdn#1622 which introduces
the SpotifyUri type and fixes broken metadata endpoint issues.

Related: hrkfdn#1732, librespot-org/librespot#1622
@roderickvd roderickvd added the SpotifyAPI Interop b/w librespot and Spotify label Nov 7, 2025
@pienczyk
Copy link

pienczyk commented Nov 7, 2025

I just built it for my Raspberry and it works. Thanks @photovoltex and @roderickvd !

@photovoltex photovoltex dismissed stale reviews from roderickvd and kingosticks via 3ee0951 November 7, 2025 22:14
# Conflicts:
#	CHANGELOG.md
#	playback/src/config.rs
@Masterolic

This comment has been minimized.

@EduardLupu
Copy link

Thanks! I wonder why they removed the preview from https://spclient.wg.spotify.com/metadata/4/track/, it broke my app. Will use this solution!

gui-wf added a commit to gui-wf/ncspot that referenced this pull request Nov 8, 2025
Fixes compatibility with librespot PR hrkfdn#1622 which changed the API
from SpotifyId::from_uri() to SpotifyUri::from_uri().

Changes:
- Updated src/spotify_worker.rs to use SpotifyUri instead of SpotifyId
- Updated Cargo.toml to use librespot from official repository
  (merge commit a9122dcb from PR hrkfdn#1622)
- Regenerated Cargo.lock with updated dependencies

Fixes hrkfdn#1732
Depends on librespot-org/librespot#1622 (merged)
hrkfdn added a commit to hrkfdn/ncspot that referenced this pull request Nov 11, 2025
* fix: adapt to librespot SpotifyUri API changes

Fixes compatibility with librespot PR #1622 which changed the API
from SpotifyId::from_uri() to SpotifyUri::from_uri().

Changes:
- Updated src/spotify_worker.rs to use SpotifyUri instead of SpotifyId
- Updated Cargo.toml to use librespot from official repository
  (merge commit a9122dcb from PR #1622)
- Regenerated Cargo.lock with updated dependencies

Fixes #1732
Depends on librespot-org/librespot#1622 (merged)

* Switch to 0.8.0 release

* Update CHANGELOG

* `cargo fmt`

---------

Co-authored-by: Guilherme Fontes <[email protected]>
Co-authored-by: Henrik Friedrichsen <[email protected]>
johnnyg added a commit to johnnyg/riff that referenced this pull request Nov 12, 2025
johnnyg added a commit to johnnyg/riff that referenced this pull request Nov 12, 2025
gstreamer-github pushed a commit to sdroege/gst-plugin-rs that referenced this pull request Nov 16, 2025
Fixes the Spotify integration by using Spotify's extended metadata endpoint, see librespot-org/librespot#1622

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2688>
gstreamer-github pushed a commit to sdroege/gst-plugin-rs that referenced this pull request Nov 17, 2025
Fixes the Spotify integration by using Spotify's extended metadata endpoint, see librespot-org/librespot#1622

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2695>
Diegovsky pushed a commit to Diegovsky/riff that referenced this pull request Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug SpotifyAPI Interop b/w librespot and Spotify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Librespot fails to play any tracks Fetching audiobooks/podcast metadata results in 502 Bad Gateway

10 participants