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

Multiple Music Folders #192

Open
chrstn-hntschl opened this issue Apr 19, 2020 · 34 comments
Open

Multiple Music Folders #192

chrstn-hntschl opened this issue Apr 19, 2020 · 34 comments

Comments

@chrstn-hntschl
Copy link

Is it possible to have navidrome manage separate folders on a user level? So for example, user A has access to all music files in folderA, user B has access to all music in folderB and user C has access to folderA and folderB? I am asking because I want to separate music from audiobooks and don't want to have all mixed up in the same view.

@deluan
Copy link
Member

deluan commented Apr 19, 2020

Thanks for trying Navidrome!

Right now it only supports one music folder. Once multiple folders are implemented, access restrictions will be supported.

@SteveDinn
Copy link

Came here to add this feature request, and found this one. This is the one feature preventing me from moving from Airsonic to Navidrome.

@cascooscuro
Copy link

would it be possible to have this functionality implemented similarly as subsonic/airsonic does?
Let me explain it. In subsonic, when you select a folder, you get a view restricted to the albums/artists in that location. Those like me who come from subsonic have been curating our libraries using some sort of folder structure. Having this functionality will really help when we migrate.
Thanks!

@deluan
Copy link
Member

deluan commented Oct 5, 2020

Yep, this is how it will work, and you are going to have different permissions and other settings for each music folder.

@Mycah
Copy link

Mycah commented Nov 30, 2020

Just found this as airsonic seems dead, but I already like this way more. Would love to see this feature added. Thanks for the awesome program.

@quotengrote
Copy link

Hi, thats the feature i am missing the most.
Anyone want to ship in in a bounty?

@deluan THX for Navidrome!

@Tuphal
Copy link

Tuphal commented Jun 17, 2021

Hi, this feature will be really nice to have.
For example my wife has a different music folder, than me. Therefore 2 seperate libraries would be best.
I would financially support a bounty.

@mayanez
Copy link
Contributor

mayanez commented Aug 17, 2021

I'd also be willing to support a bounty. Alternatively, I'd be willing to help out with the implementation as well. I'm not at all familiar with the codebase and what it would entail, but maybe if one of the maintainers could point me in the right direction I'd be happy to take a look.

@certuna
Copy link
Contributor

certuna commented Aug 18, 2021

It's not a super trivial thing. I think, from the top of my head, there's at least the following steps (please correct me if I'm wrong):

Create new database table base_folder with id (a UUID), path ("/path/to/folder1") and name (to give it a fancy name "Harry's Audiobooks Folder")

Write the server code to pick up the (comma separated?) list of base folders from the configfile and populate this table

New database table base_folder_access that maps users to base folders, with columns user_id and base_folder_id (the primary keys of these tables)

Create a folders API endpoint to allow the web UI to read/modify this table

Write the web UI code to allow admins to populate this table (ie, assign base folders to users, enter the fancy name), but DO NOT ALLOW THE API TO CREATE A NEW BASE FOLDER - SECURITY RISK!

Add to the media_file table:

  • new field base_folder_id, the UUID that references the base folder
  • new field relative_path ("/path/to/mediafile.mp3") that stores the relative path of the file, constructed by stripping the base folder path from the mediafile's path field (which would be "/path/to/folder1/path/to/mediafile.mp3")

Change the scanner so it populates these fields correctly, and ideally "intelligent" enough that when the base folder changes but the relative path stays the same (ie, a user moves his whole music folder to a new location), ND doesn't create new records for each song but just updates the base_folder_id and path.

Change all the relevant SQL queries to filter for only the base folders that the user has access to (that's relatively trivial for songs, but you also want to filter out all artists and albums (and genres) that the user has no access to.

Probably: add relativePath and baseFolderName to the song API endpoint and remove path (fixes #959 )

@Zetten
Copy link

Zetten commented Nov 8, 2021

I saw that gonic recently resolved a similar issue, which may offer some hints as to the design.

@deluan
Copy link
Member

deluan commented Nov 14, 2021

Thanks for the link. The internal structure of Gonic is very different from Navidrome, so the changes do not apply to ND. I already started working on this, but put it on hold to focus on Smart Playlists, a more important feature (at least for me personally 😉 )

@loneboat
Copy link

loneboat commented Jan 7, 2022

@loneboat
Copy link

loneboat commented Jan 8, 2022

Super please! This is so far the only feature that's keeping me from moving full-time to Navidrome.

@bachig26
Copy link

bachig26 commented Jan 22, 2022

@deluan if enabling the multiple musicfolder path option is difficult or takes time to work it at the moment. is it possible to an argument or some function to provide different paths to different user profile? so that the different folders can be linked to different user profile to make this a closer to solve in a different way.

@bachig26
Copy link

bachig26 commented Jan 22, 2022

I also have a doubt that will either of these lines work?

Example: [These will be set in the navidrome.toml file]

MusicFolder = 'E:\Music1' && 'F:\Music2'

[OR]

MusicFolder = 'E:\Music1'
MusicFolder = 'F:\Music2'

let me know if it is possible to run these arguments or something like that.

@deluan
Copy link
Member

deluan commented Jan 25, 2022

@deluan if enabling the multiple musicfolder path option is difficult or takes time to work it at the moment. is it possible to an argument or some function to provide different paths to different user profile? so that the different folders can be linked to different user profile to make this a closer to solve in a different way.

Sorry, but I don't think it is worth to spend effort doing something like this. You can already segregate your library like this by using two instances of Navidrome, something that some users are already doing.

MusicFolder = 'E:\Music1' && 'F:\Music2'

[OR]

MusicFolder = 'E:\Music1'
MusicFolder = 'F:\Music2'

This is not possible, and that's the whole point of this GH issue. But if you use Linux, you can create a symlink from one folder to another. I'm not sure if Windows supports symlinks.

@bachig26
Copy link

bachig26 commented Jan 25, 2022

You can already segregate your library like this by using two instances of Navidrome, something that some users are already doing.

I didn't know about this, can you direct me to the location where I read and make use of this?

This is not possible, and that's the whole point of this GH issue. But if you use Linux, you can create a symlink from one folder to another. I'm not sure if Windows supports symlinks.

okay, actually I thought this might work and I don't know how this issue #192 is planned to be approached. And I use Windows 10, tried with WSL which leads me to some problems, but I am using nssm now for Navidrome to run. I think Symlinks is available in Windows, I just created a symlink and it's working well with Navidrome. Thank you.

@Szeraax
Copy link

Szeraax commented Mar 8, 2022

@deluan if enabling the multiple musicfolder path option is difficult or takes time to work it at the moment. is it possible to an argument or some function to provide different paths to different user profile? so that the different folders can be linked to different user profile to make this a closer to solve in a different way.

Sorry, but I don't think it is worth to spend effort doing something like this. You can already segregate your library like this by using two instances of Navidrome, something that some users are already doing.

This is exactly what I did today! Two instances and a 3rd instance that is the "combined" version. I just added 2 volumes to the yaml file into /music/me and /music/hers. No symlinking needed.

MusicFolder = 'E:\Music1' && 'F:\Music2'
[OR]
MusicFolder = 'E:\Music1'
MusicFolder = 'F:\Music2'

This is not possible, and that's the whole point of this GH issue. But if you use Linux, you can create a symlink from one folder to another. I'm not sure if Windows supports symlinks.

To be precise, my docker config for these looks like this. All of my wife's music that she wants to be accessible on the combined instance goes into her "safe" folder. No more needing to skip adult music when kids are in the car:

  - "/share/music/kids:/music/kids:ro"
  - "/share/music/wifey/safe:/music/wifey:ro"

@Szeraax
Copy link

Szeraax commented Mar 8, 2022

I didn't know about this, can you direct me to the location where I read and make use of this?

@bachig26, just have 2 entirely separate instance of ND running. Copy the database from the data folder from one instance over to the other one if you want to have the same users across both instances. Track me down on the Discord server if you want to chat about it more.

@trumad
Copy link

trumad commented Mar 9, 2022

While waiting for this feature, my solution was to split my music folder into two folders. One that I'm happy for navidrome to index, and one that stores everything else. That's where I put new music that hasn't been tagged or had artwork added, or random audio that I want to store but not browse in navidrome.

If this feature gets implemented, it'll be nice to be able to choose the library in the UI. Eg if I want to search/browse/shuffle just my bootlegs folder/library, or my videogame or chiptune music libraries. Right now it's all lumped together.

@gmag11
Copy link

gmag11 commented Apr 13, 2022

A workaround for this would be that an album or song could be assigned to different users, allowing multiple selection. So admin can mark what users see what songs. If this was implemented, then multiple folders would be not needed.

@xinmans
Copy link

xinmans commented Jul 31, 2022

@deluan if enabling the multiple musicfolder path option is difficult or takes time to work it at the moment. is it possible to an argument or some function to provide different paths to different user profile? so that the different folders can be linked to different user profile to make this a closer to solve in a different way.

Sorry, but I don't think it is worth to spend effort doing something like this. You can already segregate your library like this by using two instances of Navidrome, something that some users are already doing.

This is exactly what I did today! Two instances and a 3rd instance that is the "combined" version. I just added 2 volumes to the yaml file into /music/me and /music/hers. No symlinking needed.

MusicFolder = 'E:\Music1' && 'F:\Music2'
[OR]
MusicFolder = 'E:\Music1'
MusicFolder = 'F:\Music2'

This is not possible, and that's the whole point of this GH issue. But if you use Linux, you can create a symlink from one folder to another. I'm not sure if Windows supports symlinks.

To be precise, my docker config for these looks like this. All of my wife's music that she wants to be accessible on the combined instance goes into her "safe" folder. No more needing to skip adult music when kids are in the car:

  - "/share/music/kids:/music/kids:ro"
  - "/share/music/wifey/safe:/music/wifey:ro"

the best solution

@K4r0qtuYNE5G4qgZ
Copy link

I like the idea and it would also be useful for me to separate some types of albums into categories or libraries.
However, I would already be happy to do the whole thing with extended tags instead special separated folders.

Like:
image
image

Which then Results in:
image

I also personaly don't care if Artists are also separated or not.
The only thing important is that albums/songs are separated.

In order not to disturb existing libraries, this tag should of course be optional, i.e. files where this is not set all go into the main library as they are currently.

@p6002
Copy link

p6002 commented Mar 12, 2023

3 years and still nothing?

@ctp-tCG
Copy link

ctp-tCG commented Mar 12, 2023

@p6002 chill, if you would like it sooner consider contributing.

@pbsds
Copy link

pbsds commented Mar 12, 2023

one possible workaround is a symlink tree: Make a folder with symlinks to all the music sources you'd like

@tcurdt
Copy link
Contributor

tcurdt commented Mar 12, 2023

one possible workaround is a symlink tree:
Make a folder with symlinks to all the music sources you'd like

I read the original reason for the ticket differently:
I think it's about having different collection and being able to assign them per user:

user1:

  • music
  • audiobooks

user2:

  • music

I don't see how symlink'ing would help here - or you have to elaborate.

@pbsds
Copy link

pbsds commented Mar 12, 2023

Sorry, i subscribed to this thread long ago, then got pinged just now. That response was based on me misremembering the topic.

@ps-gill
Copy link

ps-gill commented Aug 29, 2023

Gave it a go. The changes are rough around the edges but seems to be "working" within a short local test that I did. I can make further progress when feedback is provided.

ps-gill@21835d8

Edit:
The changes didn't feel good enough to open a PR.

@tcurdt
Copy link
Contributor

tcurdt commented Aug 29, 2023

@ps-gill That doesn't look so bad. 👍

Not sure it solves the original problem of dealing with audiobooks and music though.

@nemogoc
Copy link

nemogoc commented Oct 1, 2023

@ps-gill If I were to want to try this out on a test server, in your opinion is there anything stopping me from just building your fork?

@ps-gill
Copy link

ps-gill commented Oct 6, 2023

@ps-gill If I were to want to try this out on a test server, in your opinion is there anything stopping me from just building your fork?

Nothing really. The fork just allows one to specify multiple music folders e.g. ./navidrome --musicfolder foo --musicfolder bar.

In addition to specifying multiple folders, community seems to be looking for isolating music folders by users. I was planning to work towards that but haven't had a chance to take a stab at it.

@comatory
Copy link

I have a slightly different use case. I'd like to keep audiobooks & podcasts in separate folder. I know I could probably solve this with tagging but it would not improve browsing experience I think.
I also have NAS running Navidrome and would like to have just one instance running due to limits on CPU & RAM.

@luk6173
Copy link

luk6173 commented Apr 27, 2024

In addition to specifying multiple folders, community seems to be looking for isolating music folders by users. I was planning to work towards that but haven't had a chance to take a stab at it.

any news here? Would be great to see this feature very soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests