fix cloud library mounts and artwork caching

This commit is contained in:
ShukeBta
2026-06-10 20:43:42 +08:00
parent 0bf983cec8
commit fd0428ee7d
36 changed files with 1469 additions and 140 deletions
+28
View File
@@ -103,6 +103,13 @@ func TestScanCloudLibraryImportsRecursivePlayableMedia(t *testing.T) {
if got := countMedia(t, repos); got != 0 {
t.Fatalf("media count after prune = %d, want 0", got)
}
var allRows int64
if err := repos.DB.Unscoped().Model(&model.Media{}).Count(&allRows).Error; err != nil {
t.Fatal(err)
}
if allRows != 0 {
t.Fatalf("unscoped media count after cloud prune = %d, want 0", allRows)
}
}
func TestCloudLibraryPathParsing(t *testing.T) {
@@ -158,6 +165,27 @@ func TestCloudMountConflictDetectsNestedMounts(t *testing.T) {
}
}
func TestCancelCloudScansForProviderSignalsRunningScan(t *testing.T) {
scanner := NewScannerService(&config.Config{}, zap.NewNop(), repository.New(nil), NewHub(zap.NewNop()), nil, nil)
cancelled := false
scanner.cloudScans["lib-1"] = &cloudScanEntry{
status: CloudScanStatus{LibraryID: "lib-1", Provider: "openlist", State: "running"},
cancel: func() {
cancelled = true
},
}
if got := scanner.CancelCloudScansForProvider("openlist"); got != 1 {
t.Fatalf("cancelled = %d, want 1", got)
}
if !cancelled {
t.Fatal("cancel func was not called")
}
if state := scanner.cloudScans["lib-1"].status.State; state != "canceling" {
t.Fatalf("state = %q, want canceling", state)
}
}
func TestInferCloudMountMediaType(t *testing.T) {
cases := map[string]string{
"/日漫": "anime",