25 Commits

Author SHA1 Message Date
Deluan
b2fec7277b refactor: optimize starred items queries with parallel execution and fix test isolation
Refactored starred items functionality by extracting common logic into getStarredItems()
method that executes artist, album, and media file queries in parallel for better performance.
This eliminates code duplication between GetStarred and GetStarred2 methods while improving
response times through concurrent database queries using run.Parallel().

Also fixed test isolation issues by adding missing auth.Init(ds) call in album lists test setup.
This resolves nil pointer dereference errors in GetStarred and GetStarred2 tests when run independently.
2025-07-16 18:10:15 -04:00
Deluan
a93fa53ae7 feat: implement multi-library support for GetRandomSongs, GetSongsByGenre, GetStarred, and GetStarred2
- Added multi-library filtering to GetRandomSongs endpoint using musicFolderId parameter
- Added multi-library filtering to GetSongsByGenre endpoint using musicFolderId parameter
- Enhanced GetStarred and GetStarred2 to filter artists, albums, and songs by library
- Added Options field to MockMediaFileRepo and MockArtistRepo for test compatibility
- Added comprehensive Ginkgo/Gomega tests for all new multi-library functionality
- All tests verify proper SQL filter generation and library access validation
- Supports single/multiple musicFolderId values with fallback to all accessible libraries
2025-07-16 18:10:15 -04:00
Deluan
b9e7b7cad7 feat: implement multi-library support for GetAlbumList and GetAlbumList2 endpoints
- Enhanced selectedMusicFolderIds helper to validate and filter library IDs
- Added ApplyLibraryFilter function in filter/filters.go for library filtering
- Updated getAlbumList to support musicFolderId parameter filtering
- Added comprehensive tests for multi-library functionality
- Supports single and multiple musicFolderId values
- Falls back to all accessible libraries when no musicFolderId provided
- Validates library access permissions for user security
2025-07-16 18:10:15 -04:00
Kendall Garner
0cd15c1ddc
feat(prometheus): add metrics to Subsonic API and Plugins (#4266)
* Add prometheus metrics to subsonic and plugins

* address feedback, do not log error if operation is not supported

* add missing timestamp and client to stats

* remove .view from subsonic route

* directly inject DataStore in Prometheus, to avoid having to pass it in every call

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-06-27 22:13:57 -04:00
Deluan
677d9947f3 Make dependency injection more consistent 2024-05-08 22:21:38 -04:00
Deluan
dfcc189cff Replace all utils.Param* with req.Params 2023-12-21 17:41:09 -05:00
Deluan
d0dceae094 Add getShares and createShare Subsonic endpoints 2023-01-24 18:36:46 -05:00
Deluan
19af11efbe Simplify Subsonic API handler implementation 2022-11-21 12:57:56 -05:00
Deluan
77dbafff0f Add errorlint linter 2022-09-30 19:33:39 -04:00
Deluan
31882abf6f Upgrade Ginkgo to V2 2022-07-26 16:53:17 -04:00
Deluan
9712a5b1c6 Fix error codes for required parameters in getAlbumList 2021-11-02 21:38:08 -04:00
caiocotts
210dc6b12e
Add x-total-count to Subsonic API getAlbumList (#1360)
* Add x-total-count to Subsonic API getAlbumList

* Rename variable

Co-authored-by: Deluan <deluan@navidrome.org>
2021-09-21 20:40:39 -04:00
Deluan
110e17b004 Make MockRepo names more consistent 2021-06-08 16:30:19 -04:00
Deluan
6ee45a9ccc Move project to Navidrome GitHub organization 2021-02-06 21:46:35 -05:00
Deluan
4777cf0aba Simplify error responses 2020-10-27 15:33:28 -04:00
Deluan
d0bf37a8a9 Move mock datastore to tests package 2020-10-27 15:23:49 -04:00
Deluan
313a088f86 Make mocks strongly typed 2020-10-27 15:23:49 -04:00
Deluan
3037ea01e2 Removed more layers of indirection from the engine package 2020-10-27 15:23:48 -04:00
Deluan
df05760769 Move engine package under subsonic, as it should only be used by the Subsonic API.master
The idea is to move reusable code from `engine` to `core`, in future refactorings
2020-08-04 21:29:35 -04:00
Deluan
4c0250f9f8 Add fromYear/toYear params to getRandomSongs 2020-04-17 21:44:34 -04:00
Deluan
a698e434fd Refactor list_generator to use new filters 2020-04-17 21:44:34 -04:00
Deluan
1278863416 feat: support clients that send the API params as a x-www-form-urlencoded POST 2020-01-27 15:10:46 -05:00
Deluan
bee55c04c8 Rename project to Navidrome 2020-01-23 19:44:08 -05:00
Deluan
d7116eebd4 Implement annotations per user 2020-01-21 23:03:37 -05:00
Deluan
7610b42f4b Moved package api to subsonic under server 2020-01-19 18:23:09 -05:00