Skip to content

Update m3u files #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Update m3u files #168

wants to merge 6 commits into from

Conversation

daladim
Copy link
Contributor

@daladim daladim commented Apr 27, 2025

Hello @timusus

This MR resolves #112 .

I have been using this code for a while now, and it suits my needs.

What it does
When using an S2 Media Store, when adding or removing or reordering songs to a playlist that initially came from an .m3u file on the disk, the underlying .m3u file gets updated on disk.
This way, the .m3u files are kept in sync with the Shuttle2 database.

What it doesn't do

  • Does not work with Android Media Store (I think). That does not sound like a problem, because this store does not allow importing m3u files in the first place
  • The following are (I think) hard to do because of limitations in the Android API:
    • It does not delete the .m3u file when a playlist is deleted (i.e. when deletePlaylist or deleteAll are called).
    • It does not rename .m3u files when a playlist is renamed (i.e. when renamePlaylist is called)
    • It does not create an .m3u file when a playlist is created. Which means (among other things) that it only tracks playlists that have been imported from the storage in the first place.

Notes

  • I'm not sure how to add unit/integration tests for this feature. This may be left for future work in an upcoming MR.
  • This is a behaviour I always want. Maybe some users would prefer not having the .m3u files synced? In this case, maybe the user-facing dialog when creating a S2 Media Store may contain an opt-out checkbox to disable this?

I'd be happy to have your thoughts on this!

@timusus
Copy link
Owner

timusus commented Jun 3, 2025

I need to review this one. My only concern is we accidentally mess up m3u files, so like you say - it would be good to have an option to opt-in or out.

I'll try to find some time to have a closer look. We can always roll it out and then add opt-in/out later.

@daladim
Copy link
Contributor Author

daladim commented Jun 5, 2025

We can always roll it out and then add opt-in/out later.

It's up to you to choose here. I just have to warn that I don't have the skills in Android development to do this myself 😢 (unless you give me precise hints at how to do UI updates and store user preferences somewhere)

(I just pushed a new commit just so that the CI is now green)

@daladim daladim force-pushed the update_m3u_files branch 2 times, most recently from 31ae8b3 to 8e3528f Compare June 5, 2025 20:42
@daladim daladim force-pushed the update_m3u_files branch from 8e3528f to 7136fc8 Compare June 5, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to export playlists
2 participants