feat(scanner): add library stats to DB (#4229)

* Combine library stats migrations

* test: verify full library stats

* Fix total_songs calculation

* Fix library stats migration

* fix(scanner): log elapsed time and number of libraries updated during scan

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

* fix(scanner): refresh library stats conditionally, only if changes were detected

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

* fix(scanner): refresh library stats conditionally, only if changes were detected

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

* fix(scanner): update queries to exclude missing entries in library stats

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

---------

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan Quintão
2025-06-14 15:58:33 -04:00
committed by GitHub
parent 44834204de
commit 5667f6ab75
7 changed files with 180 additions and 15 deletions
+9
View File
@@ -14,6 +14,14 @@ type Library struct {
FullScanInProgress bool
UpdatedAt time.Time
CreatedAt time.Time
TotalSongs int
TotalAlbums int
TotalArtists int
TotalFolders int
TotalFiles int
TotalMissingFiles int
TotalSize int64
}
type Libraries []Library
@@ -32,4 +40,5 @@ type LibraryRepository interface {
ScanBegin(id int, fullScan bool) error
ScanEnd(id int) error
ScanInProgress() (bool, error)
RefreshStats(id int) error
}