feat(library): remove tracks from the library without touching the file
"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.
This commit is contained in:
@@ -193,6 +193,14 @@ var tables = []Table{
|
||||
Note: "Build metadata for explore_index: dump version, coverage " +
|
||||
"tiers, last refresh.",
|
||||
},
|
||||
{
|
||||
Name: "excluded_paths", Kind: Authored, Lifetime: Cascade,
|
||||
Note: "Paths the user removed from the library, which the scanner " +
|
||||
"must not import again. Authored: it is a decision, not " +
|
||||
"derivable from disk. Cascades with its library, and a full " +
|
||||
"rescan clears it \u2014 the only way back for a path removed by " +
|
||||
"mistake.",
|
||||
},
|
||||
{
|
||||
Name: "file_types", Kind: Derived, Lifetime: Retained,
|
||||
Note: "Static lookup rows seeded from code, not user data.",
|
||||
|
||||
@@ -240,6 +240,14 @@ func TestAuthoredCascadesAreDeliberate(t *testing.T) {
|
||||
// unsubscribing from an artist must stop the albums it queued
|
||||
// on the user's behalf.
|
||||
"download_requests": true,
|
||||
|
||||
// An exclusion says "do not import this path into library 3".
|
||||
// Remove that library and no scan will ever visit the path
|
||||
// again, so the row has nothing left to exclude it from — and
|
||||
// the data it protects is the *absence* of a row, which the
|
||||
// library removal has already achieved for everything. Adding
|
||||
// the library back is the user asking to import it afresh.
|
||||
"excluded_paths": true,
|
||||
}
|
||||
|
||||
for _, entry := range datamap.ByKind(datamap.Authored) {
|
||||
|
||||
Reference in New Issue
Block a user