Skip to content
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

Add playlists with no user to admin's playlist list. #499

Merged
merged 1 commit into from May 1, 2024

Conversation

xxxserxxx
Copy link
Contributor

This is carrying on from the various tickets under which playlists have been discussed.

For reasons well-known (#306, #311, #307, #311... but mainly #306), the Subsonic API forces playlists to be by user ID. The solution in gonic was to expect a directory layout with <playlistpath>/<userid>/.../<whatever>.m3u. This is inconvenient for users for whom gonic is not the only application using the playlist directory, and maybe not even the main one, an inconvenience exacerbated by the fact that fs.DirEntry.IsDir() returns false for directory symlinks.

This extremely trivial change does one thing: instead of throwing an error when the directory structure does not contain user IDs as the second element in the path, it merely adds those playlists to the admin's playlist list. This change has two impacts:

  1. These playlists would otherwise be entirely ignored by gonic. It's possible some users are leveraging that to have playlists in the same directory used by some other program that they intentionally hide from gonic.
  2. admin might suddenly see a bunch of playlists they didn't before, because there were playlists that were being ignored

What it accomplishes is that it allows gonic to share playlists with all of the other non-Subsonic apps that don't put playlists into int-named subdirectories.

@sentriz
Copy link
Owner

sentriz commented Apr 25, 2024

interesting. what happens then when the admin goes to edit the playlist then

@sentriz
Copy link
Owner

sentriz commented Apr 25, 2024

havent tried but I think it end up making a copy of it or something when you go to update

@xxxserxxx
Copy link
Contributor Author

xxxserxxx commented Apr 25, 2024

I don't know; I'm not using a client that allows editing the playlist, but from a quick scan of the code CreateOrSave handler reloads all the playlists and only constructs a new file path if it doesn't find a matching playlist. I believe if Admin edits an existing playlist from the parent playlist directory, it'll actually edit the playlist and not create a new one.

c.f. server/ctrlsubsonic/handlers_playlist.go#78, where it tries to load the playlist by ID using this same Load() function. The user ID doesn't come into play unless the playlist is new, in which case SaveCreateOrUpdatePlaylist() creates a new playlist path using the user ID on line 104.

What I'm not sure about is what happens when Gonic encounters duplicate playlists names -- although, this is already an issue if 3 different users all create playlists with the same name, and mark them all GLOBAL.

@sentriz sentriz merged commit f5893ea into sentriz:master May 1, 2024
1 check passed
@sentriz
Copy link
Owner

sentriz commented May 1, 2024

thanks, seems to work fine. as for muliple playlists with the same name, i think its fine since they have unique ids that match the filesystem

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.

None yet

2 participants