[GH-ISSUE #232] TRACK_ID Format ? #159

Closed
opened 2026-02-27 19:29:09 +03:00 by kerem · 5 comments
Owner

Originally created by @rperrot on GitHub (Jun 17, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/232

Hi,

first of all, I'd like to thanks all dev for their valuable work.

I'm trying to use the --onevent to get information about the currently played track.

To do this I'm using TRACK_ID environment variable in a python script. However, when querying the Spotify API I got an error result indicating that the track id is invalid. I think there's a transformation (encoding ?) between the spotify track ID and the exported environment one.

for example a valid track in spotify (using official app) 5Fhn1eNY4Eexndp9DWHZnn, is exported in the environment variable TRACK_ID value "ba292267a139477c86f108d66f4f9cc5" which is an invalid spotify track id.

I can't find a hint about how to decode the environment variable TRACK_ID. Does anybody can give me a clue to get the correct value ?

Originally created by @rperrot on GitHub (Jun 17, 2018). Original GitHub issue: https://github.com/librespot-org/librespot/issues/232 Hi, first of all, I'd like to thanks all dev for their valuable work. I'm trying to use the --onevent to get information about the currently played track. To do this I'm using TRACK_ID environment variable in a python script. However, when querying the Spotify API I got an error result indicating that the track id is invalid. I think there's a transformation (encoding ?) between the spotify track ID and the exported environment one. for example a valid track in spotify (using official app) 5Fhn1eNY4Eexndp9DWHZnn, is exported in the environment variable TRACK_ID value "ba292267a139477c86f108d66f4f9cc5" which is an invalid spotify track id. I can't find a hint about how to decode the environment variable TRACK_ID. Does anybody can give me a clue to get the correct value ?
kerem 2026-02-27 19:29:09 +03:00
Author
Owner

@rperrot commented on GitHub (Jun 17, 2018):

Ok, I found it looking into the code. (is it possible to add it in the doc ?)

TRACK_ID is in base16 so I need to decode it then encode it in base62 to use spotify api.

<!-- gh-comment-id:397885964 --> @rperrot commented on GitHub (Jun 17, 2018): Ok, I found it looking into the code. (is it possible to add it in the doc ?) TRACK_ID is in base16 so I need to decode it then encode it in base62 to use spotify api.
Author
Owner

@StopMotionCuber commented on GitHub (Jun 26, 2018):

I guess this is somewhat confusing if spotify uses base62 for its official app.
I would propose to change the TRACK_ID environment variable to base62 in this case.

<!-- gh-comment-id:400196572 --> @StopMotionCuber commented on GitHub (Jun 26, 2018): I guess this is somewhat confusing if spotify uses base62 for its official app. I would propose to change the TRACK_ID environment variable to base62 in this case.
Author
Owner

@rperrot commented on GitHub (Jun 26, 2018):

I don't want to suggest the change (if it's like that, there must be a reason), however I would suggest to document it.

<!-- gh-comment-id:400435755 --> @rperrot commented on GitHub (Jun 26, 2018): I don't want to suggest the change (if it's like that, there must be a reason), however I would suggest to document it.
Author
Owner

@kingosticks commented on GitHub (Jun 26, 2018):

It sounds wrong, the change sounds good. It's supposed to be a format you can easily use.

<!-- gh-comment-id:400481790 --> @kingosticks commented on GitHub (Jun 26, 2018): It sounds wrong, the change sounds good. It's supposed to be a format you can easily use.
Author
Owner

@sashahilton00 commented on GitHub (Nov 3, 2018):

Agreed, it should be changed to base62 to bring it inline with the other Spotify clients.

<!-- gh-comment-id:435596939 --> @sashahilton00 commented on GitHub (Nov 3, 2018): Agreed, it should be changed to base62 to bring it inline with the other Spotify clients.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#159
No description provided.