mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
Added subsonic.folderbrowsing option, and removed debugging
Signed-off-by: Patrik Wallström <pawal@amplitut.de>
This commit is contained in:
parent
501cfce841
commit
bc2cb3ab4d
@ -163,6 +163,7 @@ type subsonicOptions struct {
|
||||
ArtistParticipations bool
|
||||
DefaultReportRealPath bool
|
||||
EnableAverageRating bool
|
||||
FolderBrowsing bool
|
||||
LegacyClients string
|
||||
MinimalClients string
|
||||
}
|
||||
@ -710,6 +711,7 @@ func setViperDefaults() {
|
||||
viper.SetDefault("subsonic.artistparticipations", false)
|
||||
viper.SetDefault("subsonic.defaultreportrealpath", false)
|
||||
viper.SetDefault("subsonic.enableaveragerating", true)
|
||||
viper.SetDefault("subsonic.folderbrowsing", true)
|
||||
viper.SetDefault("subsonic.legacyclients", "DSub")
|
||||
viper.SetDefault("subsonic.minimalclients", "SubMusic")
|
||||
viper.SetDefault("agents", "deezer,lastfm,spotify")
|
||||
|
||||
@ -172,7 +172,7 @@ func (p *phaseFolders) producer() ppl.Producer[*folderEntry] {
|
||||
// Check if folder is outdated
|
||||
if folder.isOutdated() {
|
||||
if !p.state.fullScan {
|
||||
if folder.hasNoFiles() && folder.isNew() {
|
||||
if folder.hasNoFiles() && folder.isNew() && folder.numSubFolders == 0 {
|
||||
log.Trace(p.ctx, "Scanner: Skipping new folder with no files", "folder", folder.path, "lib", job.lib.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -144,13 +144,19 @@ func (api *Router) getFolderIndex(ctx context.Context, musicFolderIds []int, ifM
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Filter accessible libraries down to the requested ones
|
||||
// Fetch all libraries from the database; user.Libraries in context may be
|
||||
// empty for admin users (not in user_library table), so we can't rely on it.
|
||||
allLibraries, err := api.ds.Library(ctx).GetAll()
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error retrieving libraries for folder index", err)
|
||||
return nil, err
|
||||
}
|
||||
libIdSet := make(map[int]bool, len(musicFolderIds))
|
||||
for _, id := range musicFolderIds {
|
||||
libIdSet[id] = true
|
||||
}
|
||||
var libraries []model.Library
|
||||
for _, lib := range getUserAccessibleLibraries(ctx) {
|
||||
for _, lib := range allLibraries {
|
||||
if len(libIdSet) == 0 || libIdSet[lib.ID] {
|
||||
libraries = append(libraries, lib)
|
||||
}
|
||||
|
||||
@ -195,6 +195,7 @@ var _ = Describe("Browsing", func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
lib1 = model.Library{ID: 1, Name: "Test Library 1", Path: "/music/library1"}
|
||||
ds.Library(ctx).(*tests.MockLibraryRepo).SetData(model.Libraries{lib1})
|
||||
})
|
||||
|
||||
It("should return error when musicFolderId is not accessible", func() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user