[GH-ISSUE #665] Local music support #1323

Open
opened 2026-03-14 14:24:16 +03:00 by kerem · 14 comments
Owner

Originally created by @ManiProjs on GitHub (Jan 16, 2025).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/665

Is your feature already implemented in the latest master?
Please go through the Features README page to make sure your request feature hasn't been implemented.

Is your feature request related to a problem? Please describe.
No, it isn't.

Describe the solution you'd like
Much appreciated if you (or your contributors) add support to local music. I know that's not wise (because it named spotify_player not local_player or something else), but it would be fun to play local music.

Describe alternatives you've considered
Image
I used termusic. It is good, but not as perfect as this project. I don't like its UI. I think spotify_player is more interesting for me

Additional context
It would be good to add local music (I don't have anything else to say😁)

Originally created by @ManiProjs on GitHub (Jan 16, 2025). Original GitHub issue: https://github.com/aome510/spotify-player/issues/665 **Is your feature already implemented in the latest `master`?** Please go through the [Features README page](https://github.com/aome510/spotify-player?tab=readme-ov-file#features) to make sure your request feature hasn't been implemented. **Is your feature request related to a problem? Please describe.** No, it isn't. **Describe the solution you'd like** Much appreciated if you (or your contributors) add support to local music. I know that's not wise (because it named `spotify_player` not `local_player` or something else), but it would be fun to play local music. **Describe alternatives you've considered** <img width="1290" alt="Image" src="https://github.com/user-attachments/assets/dc369935-effa-49f8-bcde-5ff3cfd2884c" /> I used [`termusic`](https://github.com/tramhao/termusic). It is good, but not as perfect as this project. I don't like its UI. I think `spotify_player` is more interesting for me **Additional context** It would be good to add local music (I don't have anything else to say😁)
Author
Owner

@variegatedcat commented on GitHub (Feb 13, 2025):

i would like to see this implemented as well

<!-- gh-comment-id:2655266310 --> @variegatedcat commented on GitHub (Feb 13, 2025): i would like to see this implemented as well
Author
Owner

@mantacid commented on GitHub (May 10, 2025):

Same here. Some of the artists I follow don't upload to spotify, so I instead have their music downloaded, and played through spotify locally. It would be nice to do that with this program as well!

<!-- gh-comment-id:2869218125 --> @mantacid commented on GitHub (May 10, 2025): Same here. Some of the artists I follow don't upload to spotify, so I instead have their music downloaded, and played through spotify locally. It would be nice to do that with this program as well!
Author
Owner

@ManiProjs commented on GitHub (May 13, 2025):

Well, you can use termusic.
I am using it. But I like the spotify_player's UI more.
I am mentioning @aome510 because it may cause him/her to see the issue (The software is provided "as is", it means I cannot sue him/her because for not implementing the feature)
I will open a PR soon

<!-- gh-comment-id:2877569618 --> @ManiProjs commented on GitHub (May 13, 2025): Well, you can use [`termusic`](https://github.com/tramhao/termusic). I am using it. But I like the `spotify_player`'s UI more. I am mentioning @aome510 because it may cause him/her to see the issue (The software is provided "as is", it means I cannot sue him/her because for not implementing the feature) I will open a PR soon
Author
Owner

@aome510 commented on GitHub (May 13, 2025):

Thanks for raising. Somewhat related to #62. I don't have any plan to implement local music or offline feature cause I don't really need one.

That said, feel free to implement one and open a PR. PRs are welcomed and highly appreciated!

<!-- gh-comment-id:2877675708 --> @aome510 commented on GitHub (May 13, 2025): Thanks for raising. Somewhat related to #62. I don't have any plan to implement local music or offline feature cause I don't really need one. That said, feel free to implement one and open a PR. PRs are welcomed and highly appreciated!
Author
Owner

@SapiensAnatis commented on GitHub (Aug 2, 2025):

I have been looking at this a little bit, though I can't make any promises... It seems like the issue is that we pass the list of tracks returned by the Spotify API into filter_map(try_from_playlist_item) which calls try_from_full_track_with_date, which itself returns None any track that has no id set: github.com/aome510/spotify-player@a445674b6f/spotify_player/src/state/model.rs (L385)

Local files may not have an id according to rspotify_model.

My initial thoughts are that we need to map these differently with enough information so that they can be played via some alternative mechanism. I've not studied the API closely enough yet to know what that is.

<!-- gh-comment-id:3146427851 --> @SapiensAnatis commented on GitHub (Aug 2, 2025): I have been looking at this a little bit, though I can't make any promises... It seems like the issue is that we pass the list of tracks returned by the Spotify API into `filter_map(try_from_playlist_item)` which calls `try_from_full_track_with_date`, which itself returns `None` any track that has no `id` set: https://github.com/aome510/spotify-player/blob/a445674b6f6664626e1a2e0d30675f3c9831fa60/spotify_player/src/state/model.rs#L385 Local files may not have an `id` [according to `rspotify_model`](https://docs.rs/rspotify-model/0.15.0/rspotify_model/track/struct.FullTrack.html#structfield.id). My initial thoughts are that we need to map these differently with enough information so that they can be played via some alternative mechanism. I've not studied the API closely enough yet to know what that is.
Author
Owner

@SapiensAnatis commented on GitHub (Aug 10, 2025):

It is easy enough to display local files and send a request to play these to librespot (although I have done some hacks which will need cleaning up). However, librespot doesn't currently support local playback, so that will need to be implemented first. See: https://github.com/librespot-org/librespot/discussions/1525

<!-- gh-comment-id:3172623954 --> @SapiensAnatis commented on GitHub (Aug 10, 2025): It is easy enough to display local files and send a request to play these to `librespot` (although I have done some hacks which will need cleaning up). However, `librespot` doesn't currently support local playback, so that will need to be implemented first. See: https://github.com/librespot-org/librespot/discussions/1525
Author
Owner

@ManiProjs commented on GitHub (Aug 17, 2025):

Or we can use another library, such as rodio just for playing local files, and adding local file support as an optional feature. Which it can be enabled or disabled by default.

Then we can add a parameter to the app’s settings, which can be enabled with —l/—-local and settings file.

<!-- gh-comment-id:3194470488 --> @ManiProjs commented on GitHub (Aug 17, 2025): Or we can use another library, such as `rodio` just for playing local files, and adding local file support as an optional feature. Which it can be enabled or disabled by default. Then we can add a parameter to the app’s settings, which can be enabled with `—l/—-local` and settings file.
Author
Owner

@KUHLwasStolen commented on GitHub (Aug 19, 2025):

Just noticed that this issue is still active and I thought I might chime in here.

Or we can use another library, such as rodio just for playing local files,

I've done pretty much exactly this here https://github.com/KUHLwasStolen/spotify-player/tree/local-playback ...

and adding local file support as an optional feature.

... however, making it an optional feature looks pretty hard to me (at least with the approach that I took) as I had to make some major changes to spotify_player. (Not saying it's impossible, but a ton of #[cfg(feature = "local")] would be required haha)

That said, feel free to check out my fork and leave feedback.
Currently all the basic local player functionality works and I also enabled the app to start without Internet connection or login (otherwise local playback wouldn't really make sense if it still depends on Spotify/Internet anyway).
Currently supported formats are mp3 and flac, but after some more testing I can extend the support to all the usual audio formats.

Next up on my to-do list is implementing shuffle and repeat functionality.

Edit: the local player is accessible by default via pressing g o ("go offline") and it will start in the directory specified in the local_library_root config option.

<!-- gh-comment-id:3202792774 --> @KUHLwasStolen commented on GitHub (Aug 19, 2025): Just noticed that this issue is still active and I thought I might chime in here. > Or we can use another library, such as `rodio` just for playing local files, I've done pretty much exactly this here https://github.com/KUHLwasStolen/spotify-player/tree/local-playback ... > and adding local file support as an optional feature. ... however, making it an optional feature looks pretty hard to me (at least with the approach that I took) as I had to make some major changes to `spotify_player`. (Not saying it's impossible, but a ton of `#[cfg(feature = "local")]` would be required haha) That said, feel free to check out my fork and leave feedback. Currently all the basic local player functionality works and I also enabled the app to start without Internet connection or login (otherwise local playback wouldn't really make sense if it still depends on Spotify/Internet anyway). Currently supported formats are `mp3` and `flac`, but after some more testing I can extend the support to all the usual audio formats. Next up on my to-do list is implementing shuffle and repeat functionality. **Edit:** the local player is accessible by default via pressing `g o` _("go offline")_ and it will start in the directory specified in the `local_library_root` config option.
Author
Owner

@SapiensAnatis commented on GitHub (Aug 19, 2025):

Yes, I didn't consider the possibility that you could just extend the app with local audio capability directly. Nice work!

Does your player allow playing local files that are in an existing Spotify playlist? That to me would be the main advantage of doing this via Spotify.

I also want to say that I am looking into adding local files support into librespot but it looks like it could be a long road with lots of changes to the library. I have however made an initial PR to lay the groundwork with some refactoring in how the app handles URIs.

<!-- gh-comment-id:3203005277 --> @SapiensAnatis commented on GitHub (Aug 19, 2025): Yes, I didn't consider the possibility that you could just extend the app with local audio capability directly. Nice work! Does your player allow playing local files that are in an existing Spotify playlist? That to me would be the main advantage of doing this via Spotify. I also want to say that I am looking into adding local files support into librespot but it looks like it could be a long road with lots of changes to the library. I have however made an initial PR to lay the groundwork with some refactoring in how the app handles URIs.
Author
Owner

@SapiensAnatis commented on GitHub (Aug 19, 2025):

That said, maybe I misunderstood the issue a little bit - perhaps the original poster was actually talking about a separate local player (as you have made) and https://github.com/aome510/spotify-player/issues/333 is more about Spotify local files specifically (which is what I am focusing on)

<!-- gh-comment-id:3203024983 --> @SapiensAnatis commented on GitHub (Aug 19, 2025): That said, maybe I misunderstood the issue a little bit - perhaps the original poster was actually talking about a separate local player (as you have made) and https://github.com/aome510/spotify-player/issues/333 is more about Spotify local files specifically (which is what I am focusing on)
Author
Owner

@KUHLwasStolen commented on GitHub (Aug 20, 2025):

Does your player allow playing local files that are in an existing Spotify playlist? That to me would be the main advantage of doing this via Spotify.

No, my player works completely independent from Spotify, at the moment. I'm not quite sure how I would handle this tbh in the event of a device switch, because music files may be local to only one device. Or how does the official app handle this?

perhaps the original poster was actually talking about a separate local player (as you have made) and https://github.com/aome510/spotify-player/issues/333 is more about Spotify local files specifically

I think I'll also ask for more details in #333, as I'm now a bit confused myself haha

<!-- gh-comment-id:3204762698 --> @KUHLwasStolen commented on GitHub (Aug 20, 2025): > Does your player allow playing local files that are in an existing Spotify playlist? That to me would be the main advantage of doing this via Spotify. No, my player works completely independent from Spotify, at the moment. I'm not quite sure how I would handle this tbh in the event of a device switch, because music files may be local to only one device. Or how does the official app handle this? > perhaps the original poster was actually talking about a separate local player (as you have made) and https://github.com/aome510/spotify-player/issues/333 is more about Spotify local files specifically I think I'll also ask for more details in #333, as I'm now a bit confused myself haha
Author
Owner

@SapiensAnatis commented on GitHub (Aug 20, 2025):

how does the official app handle this?

Any tracks it can't find on the same device it shows as greyed out and refuses to play them with an error pop up if you try.

<!-- gh-comment-id:3204771667 --> @SapiensAnatis commented on GitHub (Aug 20, 2025): > how does the official app handle this? Any tracks it can't find on the same device it shows as greyed out and refuses to play them with an error pop up if you try.
Author
Owner

@charliefrance commented on GitHub (Aug 20, 2025):

This is the only thing stopping me from switching from official client! I have many songs from bandcamp downloaded as mp3s which are integrated into my spotify client, and since I have the files on my phone and PC it is very convenient and they work just like normal spotify songs.

<!-- gh-comment-id:3208307888 --> @charliefrance commented on GitHub (Aug 20, 2025): This is the only thing stopping me from switching from official client! I have many songs from bandcamp downloaded as mp3s which are integrated into my spotify client, and since I have the files on my phone and PC it is very convenient and they work just like normal spotify songs.
Author
Owner

@ManiProjs commented on GitHub (Sep 18, 2025):

Hello, I opened a PR (#833) now.

I currently just added a member called local_player and that member prints a message. Contributions are welcome.

<!-- gh-comment-id:3306434166 --> @ManiProjs commented on GitHub (Sep 18, 2025): Hello, I opened a PR (#833) now. I currently just added a member called `local_player` and that member prints a message. Contributions are welcome.
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/spotify-player#1323
No description provided.