-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Scanner.PurgeMissing configuration option #4107
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
Add Scanner.PurgeMissing configuration option #4107
Conversation
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments. Also, remember to run before finishing:
- make format lint test
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
I've addressed all the comments:
There's a failing test related to a database lock issue, but this appears to be an underlying concurrency issue in the test itself rather than a problem with my changes. The test fails with "database table is locked: media_file". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments. Also, code is not properly formatted:
git status --porcelain
M scanner/scanner_test.go
To fix this check, run "make format" and
... Formatted all Go files using goimports and gofmt. 67858f8 |
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
…ling Signed-off-by: Deluan <deluan@navidrome.org>
Signed-off-by: Deluan <deluan@navidrome.org>
8316b0b
to
ea7a728
Compare
This PR adds a new configuration option
Scanner.PurgeMissing
that allows users to control when missing files should be purged from the database during the scanning process.New Configuration Option
Added a new
PurgeMissing
field to thescannerOptions
inconf/configuration.go
with the following possible values:"never"
(default): Just mark missing files, albums, and artists (current behavior)"always"
: Purge any missing files/albums/artists from the DB after a scan (at the end of phase 2)"full"
: Same as "always", but only when the scan is a fullScanImplementation Details
finalize
method in thephaseMissingTracks
struct to check the configuration optionpurgeMissing
helper method that:Usage Examples
In
navidrome.toml
:or
or
This feature helps keep the database clean by removing references to files that no longer exist in the user's filesystem.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.