Skip to content

[BUG] Change in Metadata : Cause "Cannot get alternative track" #321

@Scrameupeutchi

Description

@Scrameupeutchi

Describe the bug
While we were used to encounter this bug due to various circumstances in the past, here it comes again since a few hours, preventing the use of the library. The now usual dreaded error message is appearing :

Traceback (most recent call last):
  File "/home/scrameupeutchi/.local/share/pipx/venvs/zotify/lib/python3.12/site-packages/zotify/track.py", line 304, in download_track
    stream = Zotify.get_content_stream(track, Zotify.DOWNLOAD_QUALITY)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scrameupeutchi/.local/share/pipx/venvs/zotify/lib/python3.12/site-packages/zotify/zotify.py", line 53, in get_content_stream
    return cls.SESSION.content_feeder().load(content_id, VorbisOnlyAudioQuality(quality), False, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scrameupeutchi/.local/share/pipx/venvs/zotify/lib/python3.12/site-packages/librespot/audio/__init__.py", line 771, in load
    return self.load_track(playable_id, audio_quality_picker, preload,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scrameupeutchi/.local/share/pipx/venvs/zotify/lib/python3.12/site-packages/librespot/audio/__init__.py", line 825, in load_track
    raise RuntimeError("Cannot get alternative track")
RuntimeError: Cannot get alternative track

From what I could understand from the way the track's URL is retrieved, the Metadata should contain a "file" field to get the information from. However, the result I'm getting in debug does not seems to include that parameter anymore :

> id: "v\335\317\256TGG\216\242\'i\032A\200\253\030"
> name: "Butterfly"
> album {
>   gid: "{\341\320\325E(GT\216P\214\234\273\254[N"
>   name: "Smile"
>   artist {
>     gid: "\030\206\261\217\231\361G:\202\3048\330F\334\023\361"
>     name: "SMiLE.dk"
>   }
>   label: "Parlophone Denmark"
>   date {
>     year: 1998
>     month: 7
>     day: 13
>   }
>   cover_group {
>     image {
>       file_id: "\253gam\000\000\036\002\326j\306id-u\333\265)E\253"
>       size: DEFAULT
>       width: 300
>       height: 300
>     }
>     image {
>       file_id: "\253gam\000\000HQ\326j\306id-u\333\265)E\253"
>       size: SMALL
>       width: 64
>       height: 64
>     }
>     image {
>       file_id: "\253gam\000\000\262s\326j\306id-u\333\265)E\253"
>       size: LARGE
>       width: 640
>       height: 640
>     }
>   }
> }
> artist {
>   gid: "\030\206\261\217\231\361G:\202\3048\330F\334\023\361"
>   name: "SMiLE.dk"
> }
> number: 1
> disc_number: 1
> duration: 177453
> popularity: 64
> external_id {
>   type: "isrc"
>   id: "DKABA9814003"
> }
> earliest_live_timestamp: 413146860
> has_lyrics: true
> licensor {
>   uuid: "\2037\246\256\254\247D\247\263 P\360\306n\023\217"
> }

And then, the value of Metadata.Track is None. No alternatives could be found either.
Looks Spotify is still up to shenanigans, let's hope we can find an alternative.

To Reproduce
Steps to reproduce the behavior:

  1. Use librespot-python (last version)
  2. Try to get a track
  3. It won't get through

Expected behavior
The track is downloaded and converted if needed.

Client Information (please complete the following information):

  • OS: Linux Mint 22.04
  • Python Version : 3.12.3
  • Library Version Last main branch revision

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions