Announcements

Help Wizard

Step 1

NEXT STEP

Questions about local files and the API

Solved!

Questions about local files and the API

Hello,

A few months ago, I wrote up a personal application for gathering some statistics about my listening. At the time, I didn't have a need to handle local files, but that will likely be changing soon.

 

I have a few questions about local files, but was unable to find answers in the API docs, so I figured the forums would be a good place to ask 🙂

 

My first question is if the Recently Played endpoint returns local files. The API docs indicate that the is_local flag is returned, but that does not necessarily answer whether local files are actually included in the response.

 

My next question is what properties I can expect to pull back from the API for local files, and which properties may be null. In the limited testing I did earlier with the Playlist Items endpoint, I was able to get information like the names of the track and associated album and artists, but not much else.

 

My final questions are about the URI for the local file. It appears to be structured like so: spotify:local:Artist+Name:Album+Name:Track+Name:ID. Is that format relatively consistent? What happens if metadata like the artist name or album name is not present?

Reply

Accepted Solutions
Marked as solution

I did some additional looking/testing and was able to answer my questions. Leaving what I found here in case it helps future travelers.

 

The Recently Played endpoint does not appear to return local files at the moment.

 

It appears that the only guaranteed metadata is the track name and duration. If a track name is not defined in the file metadata, it appears that the name of the file is used. In my testing, I noticed that if an album or artist was not defined in the metadata, the names for these would return as empty strings instead of null. Unsure if that's consistent behavior or if that's just because of the way my files were created.

 

The URI format is actually documented (https://developer.spotify.com/documentation/web-api/concepts/playlists#understanding-the-local-file-...), so it can safely be assumed that this is consistent. In my testing, I did find that if the artist name and album name are not provided, those are represented as empty strings in the URI (example: spotify:local:::Track+Name:Duration).

View solution in original post

1 Reply
Marked as solution

I did some additional looking/testing and was able to answer my questions. Leaving what I found here in case it helps future travelers.

 

The Recently Played endpoint does not appear to return local files at the moment.

 

It appears that the only guaranteed metadata is the track name and duration. If a track name is not defined in the file metadata, it appears that the name of the file is used. In my testing, I noticed that if an album or artist was not defined in the metadata, the names for these would return as empty strings instead of null. Unsure if that's consistent behavior or if that's just because of the way my files were created.

 

The URI format is actually documented (https://developer.spotify.com/documentation/web-api/concepts/playlists#understanding-the-local-file-...), so it can safely be assumed that this is consistent. In my testing, I did find that if the artist name and album name are not provided, those are represented as empty strings in the URI (example: spotify:local:::Track+Name:Duration).

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random