Implemented comprehensive library filtering for tag repositories to support the multi-library feature. This change ensures that users only see tags from libraries they have access to, while admin users can see all tags.
Key changes:
- Enhanced TagRepository.Add() method to accept libraryID parameter for proper library association
- Updated baseTagRepository to implement library-aware queries with proper joins
- Added library_tag table integration for per-library tag statistics
- Implemented user permission-based filtering through user_library associations
- Added comprehensive test coverage for library filtering scenarios
- Updated UI data provider to include tag filtering by selected libraries
- Modified scanner to pass library ID when adding tags during folder processing
The implementation maintains backward compatibility while providing proper isolation between libraries for tag-based operations like genres and other metadata tags.
Introduced a new column `default_new_users` in the library table to
facilitate automatic assignment of default libraries to new regular users.
When a new user is created, they will now be assigned to libraries marked
as default, enhancing user experience by ensuring they have immediate access
to essential resources. Additionally, updated the user repository logic
to handle this new functionality and modified the user creation validation
to reflect that library selection is optional for non-admin users.
Signed-off-by: Deluan <deluan@navidrome.org>
Implemented musicFolderId parameter support for Subsonic API Search2 and Search3 endpoints, completing multi-library functionality across all Subsonic endpoints.
Key changes:
- Added musicFolderId parameter handling to Search2 and Search3 endpoints
- Updated search logic to filter results by specified library or all accessible libraries when parameter not provided
- Added proper error handling for invalid/inaccessible musicFolderId values
- Refactored SearchableRepository interface to support library filtering with variadic QueryOptions
- Updated repository implementations (Album, Artist, MediaFile) to handle library filtering in search operations
- Added comprehensive test coverage with robust assertions verifying library filtering works correctly
- Enhanced mock repositories to capture QueryOptions for test validation
Signed-off-by: Deluan <deluan@navidrome.org>
Updated the GetIndex method signature to accept a slice of library IDs instead of a single ID, enabling support for filtering artists across multiple libraries simultaneously.
Changes include:
- Modified ArtistRepository interface in model/artist.go
- Updated implementation in persistence/artist_repository.go with improved library filtering logic
- Refactored Subsonic API browsing.go to use new selectedMusicFolderIds helper
- Added comprehensive test coverage for multiple library scenarios
- Updated mock repository implementation for testing
This change improves flexibility for multi-library operations while maintaining backward compatibility through the selectedMusicFolderIds helper function.
- Add library_id field to smart playlist criteria system
- Supports Is and IsNot operators for filtering by library ID
- Includes comprehensive test coverage for single values and lists
- Enables creation of library-specific smart playlists
* attempt using artist | albumartist
* add primary stats, expose to ND and Subsonic
* response to feedback (1)
* address feedback part 1
* fix docs and artist show
* fix migration order
---------
Co-authored-by: Deluan Quintão <deluan@navidrome.org>
* Fix artist not being marked as touched during quick scans
When a new album is added during quick scans, artists were not being
marked as 'touched' due to media files having older modification times
than the scan completion time.
Changes:
- Add 'updated_at' to artist Put() columns in scanner to ensure
timestamp is set when artists are processed
- Simplify RefreshStats query to check artist.updated_at directly
instead of complex media file joins
- Artists from new albums now properly get refreshed in later phases
This fixes the issue where newly added albums would have incomplete
artist information after quick scans.
* fix(missing): refresh artist stats in background after deleting missing files
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(request): add InternalAuth to user context
Signed-off-by: Deluan <deluan@navidrome.org>
* Add comprehensive test for artist stats update during quick scans
- Add test that verifies artist statistics are correctly updated when new files are added during incremental scans
- Test ensures both overall stats (AlbumCount, SongCount) and role-specific stats are properly refreshed
- Validates fix for artist stats not being refreshed during quick scans when new albums are added
- Uses real artist repository instead of mock to verify actual stats calculation behavior
---------
Signed-off-by: Deluan <deluan@navidrome.org>
* fix: ensure full scan refreshes all artist stats
After PR #4059, full scans were not forcing a refresh of all artists.
This change ensures that during full scans, all artist stats are refreshed
instead of only those with recently updated media files.
Changes:
- Set changesDetected=true at start of full scans to ensure maintenance operations run
- Add allArtists parameter to RefreshStats() method
- Pass fullScan state to RefreshStats to control refresh scope
- Update mock repository to match new interface
Fixes#4246
Related to PR #4059
* fix: add tests for full and incremental scans
Signed-off-by: Deluan <deluan@navidrome.org>
---------
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(ui,scanner,subsonic): Allow nullable replaygain and support 0.0
Resolves#4236.
Makes the replaygain columns (track/album gain/peak) nullable.
Converts the type to a pointer, allowing for 0.0 (a valid value) to be returned from Subsonic.
Updates tests for this behavior.
* small refactor
Signed-off-by: Deluan <deluan@navidrome.org>
---------
Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
* Add migration converting playqueue current to index
* refactor
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(queue): ensure valid current index and improve test coverage
Signed-off-by: Deluan <deluan@navidrome.org>
---------
Signed-off-by: Deluan <deluan@navidrome.org>
* Update song playlist menu and endpoint
* feat(ui): show submenu on click, not on hover
Signed-off-by: Deluan <deluan@navidrome.org>
* feat(ui): integrate dataProvider for fetching playlists in song context menu
Signed-off-by: Deluan <deluan@navidrome.org>
* feat(ui): update song context menu to use dataProvider for fetching playlists and inspecting songs
Signed-off-by: Deluan <deluan@navidrome.org>
* feat(ui): stop event propagation when closing playlist submenu
Signed-off-by: Deluan <deluan@navidrome.org>
* feat(ui): add 'show in playlist' option to options object
Signed-off-by: Deluan <deluan@navidrome.org>
---------
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(server): bring back legacy date mappings
Signed-off-by: Deluan <deluan@navidrome.org>
* reuse the mapDates logic in the legacyReleaseDate function
Signed-off-by: Deluan <deluan@navidrome.org>
* fix mappings
Signed-off-by: Deluan <deluan@navidrome.org>
* show original and release dates in album grid
Signed-off-by: Deluan <deluan@navidrome.org>
* fix tests based on new year mapping
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(subsonic): prefer returning original_year over (recording) year
when sorting albums
Signed-off-by: Deluan <deluan@navidrome.org>
* fix case when we don't have originalYear
Signed-off-by: Deluan <deluan@navidrome.org>
* show all dates in album's info, and remove the recording date from the album page
Signed-off-by: Deluan <deluan@navidrome.org>
* better?
Signed-off-by: Deluan <deluan@navidrome.org>
* add snapshot tests for Album Details
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(subsonic): sort order for getAlbumList?type=byYear
Signed-off-by: Deluan <deluan@navidrome.org>
---------
Signed-off-by: Deluan <deluan@navidrome.org>
* fix displayArtist logic
Signed-off-by: Deluan <deluan@navidrome.org>
* remove unneeded value
Signed-off-by: Deluan <deluan@navidrome.org>
* refactor
Signed-off-by: Deluan <deluan@navidrome.org>
* Use first albumartist if it cannot figure out the display name
Signed-off-by: Deluan <deluan@navidrome.org>
---------
Signed-off-by: Deluan <deluan@navidrome.org>