"Remove from library" deletes the audio_files row and records the path as excluded, so the next scan does not import it again. Without the exclusion the operation undoes itself on the next scan, which is worse than not having it at all; the file on disk is never touched, which is the promise the confirmation copy will make. The soft scan compares the number of audio files on disk against the number of rows, so both walks now skip excluded paths — otherwise the two counts disagree forever and every launch queues a full scan of the whole library. A full rescan clears the exclusions, which is the only way back for a path removed by mistake until there is a UI for it.
16 lines
404 B
SQL
16 lines
404 B
SQL
-- name: ExcludePath :exec
|
|
INSERT INTO excluded_paths (library_id, file_path)
|
|
VALUES (?, ?)
|
|
ON CONFLICT(library_id, file_path) DO NOTHING;
|
|
|
|
-- name: GetExcludedPathsByLibrary :many
|
|
SELECT file_path FROM excluded_paths
|
|
WHERE library_id = ?;
|
|
|
|
-- name: CountExcludedPathsByLibrary :one
|
|
SELECT COUNT(*) FROM excluded_paths
|
|
WHERE library_id = ?;
|
|
|
|
-- name: ClearExcludedPaths :exec
|
|
DELETE FROM excluded_paths;
|