One self-hosted app for your shows, movies and music.
HolyArrs 1.0.12 (#217)
CoderLuii5fd2f68235a1
diff --git a/.github/readme/README.ar.md b/.github/readme/README.ar.mdindex 40e87e2..3c7a4da 100644--- a/.github/readme/README.ar.md+++ b/.github/readme/README.ar.md@@ -202,7 +202,7 @@ docker compose up -d| الوسم | استخدمه لـ || :----: | --- || `latest` | أحدث إصدار. |-| `1.0.11` | إصدار واحد بعينه. لا يتحرك أبدًا. |+| `1.0.12` | إصدار واحد بعينه. لا يتحرك أبدًا. |## الاستخدامdiff --git a/.github/readme/README.de.md b/.github/readme/README.de.mdindex 1f47f66..e55504c 100644--- a/.github/readme/README.de.md+++ b/.github/readme/README.de.md@@ -200,7 +200,7 @@ Die Images liegen auf Docker Hub als [`holyarrs/holyarrs`](https://hub.docker.co| Tag | Dafür nutzen || :----: | --- || `latest` | Die neueste Version. |-| `1.0.11` | Eine genaue Version. Sie ändert sich nie. |+| `1.0.12` | Eine genaue Version. Sie ändert sich nie. |## Verwendungdiff --git a/.github/readme/README.es.md b/.github/readme/README.es.mdindex 446a636..2ceefcb 100644--- a/.github/readme/README.es.md+++ b/.github/readme/README.es.md@@ -200,7 +200,7 @@ Las imágenes están en Docker Hub como [`holyarrs/holyarrs`](https://hub.docker| Etiqueta | Para qué sirve || :----: | --- || `latest` | La versión más reciente. |-| `1.0.11` | Una versión exacta. Nunca se mueve. |+| `1.0.12` | Una versión exacta. Nunca se mueve. |## Usodiff --git a/.github/readme/README.fr.md b/.github/readme/README.fr.mdindex ea622df..8491f11 100644--- a/.github/readme/README.fr.md+++ b/.github/readme/README.fr.md@@ -200,7 +200,7 @@ Les images sont sur Docker Hub sous le nom [`holyarrs/holyarrs`](https://hub.doc| Étiquette | À utiliser pour || :----: | --- || `latest` | La version la plus récente. |-| `1.0.11` | Une version précise. Elle ne bouge jamais. |+| `1.0.12` | Une version précise. Elle ne bouge jamais. |## Utilisationdiff --git a/.github/readme/README.hi.md b/.github/readme/README.hi.mdindex 2bec48b..254f4ed 100644--- a/.github/readme/README.hi.md+++ b/.github/readme/README.hi.md@@ -200,7 +200,7 @@ NAS पर चला रहे हैं? देखिए [Unraid, Synology औ| टैग | किसके लिए || :----: | --- || `latest` | नवीनतम रिलीज़। |-| `1.0.11` | एक तय वर्ज़न। यह कभी नहीं बदलता। |+| `1.0.12` | एक तय वर्ज़न। यह कभी नहीं बदलता। |## इस्तेमालdiff --git a/.github/readme/README.it.md b/.github/readme/README.it.mdindex f0e6637..ae05393 100644--- a/.github/readme/README.it.md+++ b/.github/readme/README.it.md@@ -200,7 +200,7 @@ Le immagini sono su Docker Hub come [`holyarrs/holyarrs`](https://hub.docker.com| Tag | A cosa serve || :----: | --- || `latest` | La versione più recente. |-| `1.0.11` | Una versione esatta. Non cambia mai. |+| `1.0.12` | Una versione esatta. Non cambia mai. |## Utilizzodiff --git a/.github/readme/README.ja.md b/.github/readme/README.ja.mdindex 5740c8c..0cec202 100644--- a/.github/readme/README.ja.md+++ b/.github/readme/README.ja.md@@ -200,7 +200,7 @@ NAS をお使いですか。[Unraid、Synology などの NAS](https://docs.HolyA| タグ | 用途 || :----: | --- || `latest` | 最新のリリース。 |-| `1.0.11` | 特定の1つのバージョンです。動くことはありません。 |+| `1.0.12` | 特定の1つのバージョンです。動くことはありません。 |## 使い方diff --git a/.github/readme/README.ko.md b/.github/readme/README.ko.mdindex b07e204..69e2f3f 100644--- a/.github/readme/README.ko.md+++ b/.github/readme/README.ko.md@@ -200,7 +200,7 @@ NAS를 쓰세요? [Unraid, Synology 및 기타 NAS](https://docs.HolyArrs.com/ru| 태그 | 용도 || :----: | --- || `latest` | 최신 릴리스. |-| `1.0.11` | 정확히 한 버전이에요. 절대 움직이지 않아요. |+| `1.0.12` | 정확히 한 버전이에요. 절대 움직이지 않아요. |## 사용법diff --git a/.github/readme/README.nl.md b/.github/readme/README.nl.mdindex 7e39056..b965fba 100644--- a/.github/readme/README.nl.md+++ b/.github/readme/README.nl.md@@ -200,7 +200,7 @@ De images staan op Docker Hub als [`holyarrs/holyarrs`](https://hub.docker.com/r| Tag | Gebruik het voor || :----: | --- || `latest` | De nieuwste versie. |-| `1.0.11` | Eén exacte versie. Die verandert nooit. |+| `1.0.12` | Eén exacte versie. Die verandert nooit. |## Gebruikdiff --git a/.github/readme/README.pl.md b/.github/readme/README.pl.mdindex 47c09d9..5fdebbf 100644--- a/.github/readme/README.pl.md+++ b/.github/readme/README.pl.md@@ -200,7 +200,7 @@ Image'e są na Docker Hub jako [`holyarrs/holyarrs`](https://hub.docker.com/r/ho| Tag | Do czego użyć || :----: | --- || `latest` | Najnowsza wersja. |-| `1.0.11` | Jedna dokładna wersja. Nigdy się nie zmienia. |+| `1.0.12` | Jedna dokładna wersja. Nigdy się nie zmienia. |## Użyciediff --git a/.github/readme/README.pt-BR.md b/.github/readme/README.pt-BR.mdindex 7927e05..5f69f25 100644--- a/.github/readme/README.pt-BR.md+++ b/.github/readme/README.pt-BR.md@@ -200,7 +200,7 @@ As imagens ficam no Docker Hub como [`holyarrs/holyarrs`](https://hub.docker.com| Tag | Use para || :----: | --- || `latest` | A versão mais recente. |-| `1.0.11` | Uma versão exata. Nunca muda. |+| `1.0.12` | Uma versão exata. Nunca muda. |## Usodiff --git a/.github/readme/README.ru.md b/.github/readme/README.ru.mdindex 20b0edf..33d15f0 100644--- a/.github/readme/README.ru.md+++ b/.github/readme/README.ru.md@@ -200,7 +200,7 @@ HolyArrs только читает ваши старые приложения и| Тег | Для чего || :----: | --- || `latest` | Самая новая версия. |-| `1.0.11` | Одна точная версия. Никогда не сдвигается. |+| `1.0.12` | Одна точная версия. Никогда не сдвигается. |## Использованиеdiff --git a/.github/readme/README.tr.md b/.github/readme/README.tr.mdindex 910f4ba..11003dc 100644--- a/.github/readme/README.tr.md+++ b/.github/readme/README.tr.md@@ -200,7 +200,7 @@ NAS mı kullanıyorsun? [Unraid, Synology ve diğer NAS cihazları](https://docs| Etiket | Ne için kullanılır || :----: | --- || `latest` | En yeni sürüm. |-| `1.0.11` | Tam olarak tek bir sürüm. Asla değişmez. |+| `1.0.12` | Tam olarak tek bir sürüm. Asla değişmez. |## Kullanımdiff --git a/.github/readme/README.uk.md b/.github/readme/README.uk.mdindex 9c72d08..a00c174 100644--- a/.github/readme/README.uk.md+++ b/.github/readme/README.uk.md@@ -200,7 +200,7 @@ HolyArrs лише читає твої старі застосунки й ніч| Тег | Для чого || :----: | --- || `latest` | Найновіша версія. |-| `1.0.11` | Одна точна версія. Вона ніколи не змінюється. |+| `1.0.12` | Одна точна версія. Вона ніколи не змінюється. |## Використанняdiff --git a/.github/readme/README.zh-CN.md b/.github/readme/README.zh-CN.mdindex f1455d3..8ffe1ed 100644--- a/.github/readme/README.zh-CN.md+++ b/.github/readme/README.zh-CN.md@@ -200,7 +200,7 @@ HolyArrs 只读取你的旧应用,不会改动它们里面的任何东西,| 标签 | 用途 || :----: | --- || `latest` | 最新版本。 |-| `1.0.11` | 固定的某一个版本,永远不会变。 |+| `1.0.12` | 固定的某一个版本,永远不会变。 |## 用法diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 65ffd4a..a7c938c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,14 @@All notable changes to HolyArrs are listed here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow [Semantic Versioning](https://semver.org/).+## 1.0.12++### Fixed++- Importing from other apps no longer stops with "the plan changed since its dry run". ([#205](https://github.com/HolyArrs/HolyArrs/issues/205))+- A download finishes when the same file is already in place, for example after Sonarr or Radarr got there first. ([#207](https://github.com/HolyArrs/HolyArrs/issues/207))+- The poster wall shows trending movies while your Library has no posters yet. ([#215](https://github.com/HolyArrs/HolyArrs/issues/215))+## 1.0.11### Addeddiff --git a/README.md b/README.mdindex 47195cd..187aa18 100644--- a/README.md+++ b/README.md@@ -200,7 +200,7 @@ Images live on Docker Hub as [`holyarrs/holyarrs`](https://hub.docker.com/r/holy| Tag | Use it for || :----: | --- || `latest` | The newest release. |-| `1.0.11` | One exact version. It never moves. |+| `1.0.12` | One exact version. It never moves. |## Usagediff --git a/VERSION b/VERSIONindex 59e9e60..bb83058 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.0.11+1.0.12diff --git a/app/backend/internal/importer/importer.go b/app/backend/internal/importer/importer.goindex 3eca621..058e87f 100644--- a/app/backend/internal/importer/importer.go+++ b/app/backend/internal/importer/importer.go@@ -413,6 +413,24 @@ func sameContent(a, b string, size int64) bool {return x != nil && bytes.Equal(x, y)}+// sameFullContent hashes both files in full and compares them.+func sameFullContent(a, b string) bool {+ sum := func(p string) []byte {+ f, err := os.Open(p)+ if err != nil {+ return nil+ }+ defer f.Close()+ h := sha256.New()+ if _, err := io.Copy(h, f); err != nil {+ return nil+ }+ return h.Sum(nil)+ }+ x, y := sum(a), sum(b)+ return x != nil && bytes.Equal(x, y)+}+// Execute runs the steps with ops and returns one result per step.func Execute(steps []mediafiles.PlanStep, ops Ops) []mediafiles.PlaceResult {return execute(steps, ops, nil)@@ -463,6 +481,11 @@ func place(s mediafiles.PlanStep, ops Ops, resumeFrom time.Time) mediafiles.Placr.Outcome, r.PlacedBy, r.FellBack = "placed", "copy", truereturn r}+ // Another app may have placed the same file first; take it as ours.+ if tfi.Mode().IsRegular() && tfi.Size() == sfi.Size() && sameFullContent(s.SourceFile, s.TargetPath) {+ r.Outcome, r.PlacedBy, r.FellBack = "placed", "copy", true+ return r+ }r.Outcome, r.Error = "refused", "a file HolyArrs did not place is already at the target"return r}diff --git a/app/backend/internal/importer/importer_test.go b/app/backend/internal/importer/importer_test.goindex cc394d5..5135f80 100644--- a/app/backend/internal/importer/importer_test.go+++ b/app/backend/internal/importer/importer_test.go@@ -1,6 +1,7 @@package importerimport (+ "bytes""context""database/sql""errors"@@ -270,3 +271,71 @@ func TestIsCrossDevice(t *testing.T) {t.Fatal("sanity")}}++func TestExecuteTakesHardlinkAlreadyAtTarget(t *testing.T) {+ dl, lib := t.TempDir(), t.TempDir()+ src := filepath.Join(dl, relName+".mkv")+ write(t, src, 1000)+ cands, _ := Scan(dl)+ steps := Plan(cands, target(lib))+ if err := os.MkdirAll(filepath.Dir(steps[0].TargetPath), 0o755); err != nil {+ t.Fatal(err)+ }+ if err := os.Link(src, steps[0].TargetPath); err != nil {+ t.Skip("hardlinks not supported here:", err)+ }+ res := Execute(steps, Ops{})+ if res[0].Outcome != "placed" {+ t.Fatalf("result %+v", res)+ }+}++func TestExecuteTakesIdenticalCopyAtTarget(t *testing.T) {+ dl, lib := t.TempDir(), t.TempDir()+ src := filepath.Join(dl, relName+".mkv")+ body := bytes.Repeat([]byte("holyarrs"), 400000)+ if err := os.WriteFile(src, body, 0o644); err != nil {+ t.Fatal(err)+ }+ cands, _ := Scan(dl)+ steps := Plan(cands, target(lib))+ if err := os.MkdirAll(filepath.Dir(steps[0].TargetPath), 0o755); err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(steps[0].TargetPath, body, 0o644); err != nil {+ t.Fatal(err)+ }+ res := Execute(steps, Ops{})+ if res[0].Outcome != "placed" {+ t.Fatalf("result %+v", res)+ }+ if got, _ := os.ReadFile(steps[0].TargetPath); !bytes.Equal(got, body) {+ t.Fatal("existing file was changed")+ }+}++func TestExecuteRefusesSameSizeDifferentFile(t *testing.T) {+ dl, lib := t.TempDir(), t.TempDir()+ src := filepath.Join(dl, relName+".mkv")+ body := bytes.Repeat([]byte("holyarrs"), 400000)+ if err := os.WriteFile(src, body, 0o644); err != nil {+ t.Fatal(err)+ }+ cands, _ := Scan(dl)+ steps := Plan(cands, target(lib))+ other := bytes.Clone(body)+ other[len(other)/2] ^= 1 // differs only in the middle+ if err := os.MkdirAll(filepath.Dir(steps[0].TargetPath), 0o755); err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(steps[0].TargetPath, other, 0o644); err != nil {+ t.Fatal(err)+ }+ res := Execute(steps, Ops{})+ if res[0].Outcome != "refused" || !strings.Contains(res[0].Error, "did not place") {+ t.Fatalf("result %+v", res)+ }+ if got, _ := os.ReadFile(steps[0].TargetPath); !bytes.Equal(got, other) {+ t.Fatal("existing file was changed")+ }+}diff --git a/app/backend/internal/importer/retry_test.go b/app/backend/internal/importer/retry_test.goindex a292afd..0136ddd 100644--- a/app/backend/internal/importer/retry_test.go+++ b/app/backend/internal/importer/retry_test.go@@ -189,7 +189,8 @@ func TestCopyFallsBackWhenLinkUnsupported(t *testing.T) {}}-func TestRetryIgnoresTargetOlderThanImport(t *testing.T) {+// An identical file is taken whatever its age; another app may have placed it.+func TestRetryTakesIdenticalTargetOlderThanImport(t *testing.T) {dir := t.TempDir()src, dst := filepath.Join(dir, "a.mkv"), filepath.Join(dir, "b.mkv")write(t, src, 100)@@ -200,8 +201,8 @@ func TestRetryIgnoresTargetOlderThanImport(t *testing.T) {old := started.Add(-time.Hour)_ = os.Chtimes(dst, old, old)step := mediafiles.PlanStep{SourceFile: src, TargetPath: dst, Method: "hardlink"}- if r := place(step, Ops{}, started); r.Outcome != "refused" {- t.Fatalf("older file adopted: %+v", r)+ if r := place(step, Ops{}, started); r.Outcome != "placed" {+ t.Fatalf("older identical file not adopted: %+v", r)}fresh := started.Add(-time.Second)_ = os.Chtimes(dst, fresh, fresh)diff --git a/app/backend/internal/migrate/large_lidarr_hash_test.go b/app/backend/internal/migrate/large_lidarr_hash_test.gonew file mode 100644index 0000000..001f73b--- /dev/null+++ b/app/backend/internal/migrate/large_lidarr_hash_test.go@@ -0,0 +1,115 @@+package migrate++import (+ "context"+ "fmt"+ "path/filepath"+ "strings"+ "testing"+ "time"+)++// bigLidarr is a Lidarr read with many artists, albums and files.+func bigLidarr(n int) *Snapshot {+ s := &Snapshot{Kind: Lidarr, Via: ViaAPI, Version: "2.9.6",+ Folders: []Folder{{Path: "/music"}},+ QualityProfiles: []Profile{{ID: 1, Name: "Lossless", Cutoff: "FLAC"}},+ MetadataProfiles: []Named{{ID: 1, Name: "Standard", Settings: map[string]any{+ "primaryalbumtypes": []any{map[string]any{"name": "Album", "allowed": true}, map[string]any{"name": "EP", "allowed": true}},+ "secondaryalbumtypes": []any{map[string]any{"name": "Studio", "allowed": true}, map[string]any{"name": "Mixtape/Street", "allowed": true}},+ "releasestatuses": []any{map[string]any{"name": "Official", "allowed": true}},+ }}},+ }+ for i := 0; i < n; i++ {+ ids := map[string]string{"musicbrainz": fmt.Sprintf("%08x-d505-4dad-8ec1-d04f521cbb56", i+1)}+ for j := 0; j < 12; j++ {+ ids[fmt.Sprintf("extra%02d", j)] = fmt.Sprintf("%d-%d", i, j)+ }+ t := Title{SourceID: int64(i + 1), Kind: "artist", Name: fmt.Sprintf("Artist %d", i), Path: fmt.Sprintf("/music/Artist %d", i),+ Monitored: i%3 != 0, ProfileID: 1, IDs: ids, Tags: []string{"a"},+ Extra: map[string]any{"new_albums": "all", "metadata_profile_id": int64(1), "artist_metadata_id": int64(i + 10)}}+ for a := 0; a < 5; a++ {+ t.MusicAlbums = append(t.MusicAlbums, MusicAlbum{MBID: fmt.Sprintf("%08x-%04x-4dad-8ec1-d04f521cbb56", i+1, a), Monitored: a%2 == 0})+ t.Files = append(t.Files, TitleFile{Name: fmt.Sprintf("%02d - Track.flac", a), Quality: "FLAC"})+ }+ s.Titles = append(s.Titles, t)+ }+ return s+}++func TestLargeLidarrMoveStartsFromItsPreview(t *testing.T) {+ l := newMoveLab(t)+ music := filepath.ToSlash(t.TempDir())+ s := bigLidarr(400)+ s.finish()+ saved, err := Save(context.Background(), l.st, 1, s)+ if err != nil {+ t.Fatal(err)+ }+ l.snaps = append(l.snaps, saved.ID)+ ch := Choices{PathRules: append(append([]PathRule{}, l.rules...), PathRule{From: "/music", To: music}), People: l.people}+ want := PlanHash(l.planWith(t, ch))+ for i := 0; i < 20; i++ {+ if got := PlanHash(l.planWith(t, ch)); got != want {+ t.Fatalf("the same read and choices gave another plan (run %d)", i)+ }+ }+ mv := l.move(t, ch)+ for _, n := range mv.Report.Next {+ if strings.Contains(n, "could not start") {+ t.Fatalf("the move refused its own preview: %s", n)+ }+ }+}++func (l *moveLab) planWith(t *testing.T, ch Choices) *Plan {+ t.Helper()+ p, err := LoadPlan(context.Background(), l.st, l.snaps, ch)+ if err != nil {+ t.Fatal(err)+ }+ return p+}++func TestPlanHashCoversOnlyWhatTheMoveDoes(t *testing.T) {+ s := bigLidarr(3)+ ch := Choices{PathRules: []PathRule{{From: "/music", To: "/m"}}}+ p := BuildPlan([]Input{{ID: 1, Snap: s}}, ch)+ want := PlanHash(p)+ // Wording, positions and the not-moved list do not refuse a move.+ p.NotMoved = append(p.NotMoved, NotMoved{What: "x"})+ p.Notes = append(p.Notes, "note")+ for gi := range p.Groups {+ for ii := range p.Groups[gi].Items {+ p.Groups[gi].Items[ii].Detail += " (reworded)"+ p.Groups[gi].Items[ii].From = "lidarr titles[99]"+ }+ }+ if PlanHash(p) != want {+ t.Fatal("a harmless difference changed the approval")+ }+ // What an item does, the choices and the read still count.+ other := bigLidarr(3)+ other.Titles[0].Monitored = !other.Titles[0].Monitored+ for name, q := range map[string]*Plan{+ "item changed": BuildPlan([]Input{{ID: 1, Snap: other}}, ch),+ "rules changed": BuildPlan([]Input{{ID: 1, Snap: s}}, Choices{PathRules: []PathRule{{From: "/music", To: "/n"}}}),+ "group skipped": BuildPlan([]Input{{ID: 1, Snap: s}}, Choices{PathRules: ch.PathRules, Skip: []string{GroupTitles}}),+ "another read": BuildPlan([]Input{{ID: 2, Snap: s}}, ch),+ } {+ if PlanHash(q) == want {+ t.Errorf("%s: the approval did not change", name)+ }+ }+}++func TestReportBeforeStartHasTimeAndSummary(t *testing.T) {+ when := time.Date(2026, 11, 10, 12, 0, 0, 0, time.UTC)+ md := (&Report{Move: 3, At: when, Lines: []Line{}, Counts: map[string]int{}, Next: []string{"x"}}).Markdown()+ if !strings.Contains(md, "- When: 2026-11-10 12:00 UTC") || !strings.Contains(md, "- In short: nothing was moved") {+ t.Fatalf("report:\n%s", md)+ }+ if strings.Contains((&Report{Counts: map[string]int{}}).Markdown(), "0001-01-01") {+ t.Fatal("a report with no time printed year 1")+ }+}diff --git a/app/backend/internal/migrate/moves.go b/app/backend/internal/migrate/moves.goindex 08eec7e..0e84b4b 100644--- a/app/backend/internal/migrate/moves.go+++ b/app/backend/internal/migrate/moves.go@@ -154,7 +154,7 @@ const stoppedNote = "HolyArrs stopped during this import, before it finished. Wh// instead of blocking every later move. A move whose Job is still there is// resumed by the queue (a move is safe to repeat).func (m *Mover) Recover(ctx context.Context) error {- b, _ := json.Marshal(&Report{Lines: []Line{}, Counts: map[string]int{}, NotMoved: []NotMoved{}, NeedsInput: []string{}, Next: []string{stoppedNote}})+ b, _ := json.Marshal(&Report{At: m.now(), Lines: []Line{}, Counts: map[string]int{}, NotMoved: []NotMoved{}, NeedsInput: []string{}, Next: []string{stoppedNote}})// Only a move with a live job can resume. Orphaned moves keep the// interrupted-move report below instead of becoming approval failures.pending, err := moves(ctx, m.Store, `WHERE state IN ('queued', 'running')@@ -168,7 +168,7 @@ func (m *Mover) Recover(ctx context.Context) error {planErr = ErrPlanChanged}if planErr != nil {- rep := &Report{Move: mv.ID, Lines: []Line{}, Counts: map[string]int{}, Next: []string{"This queued import no longer matches an approved preview. Preview it again and start a new import."}}+ rep := &Report{Move: mv.ID, At: m.now(), Lines: []Line{}, Counts: map[string]int{}, Next: []string{"This queued import no longer matches an approved preview. Preview it again and start a new import."}}if err := m.setState(ctx, mv.ID, "failed", rep); err != nil {return err}@@ -206,7 +206,7 @@ func (m *Mover) handle(ctx context.Context, r *jobs.Run) error {if r.Stopping() {return ctx.Err() // a stop while reading the plan: resume after the restart}- _ = m.setState(context.WithoutCancel(ctx), mv.ID, "failed", &Report{Move: mv.ID, Lines: []Line{}, Counts: map[string]int{},+ _ = m.setState(context.WithoutCancel(ctx), mv.ID, "failed", &Report{Move: mv.ID, At: m.now(), Lines: []Line{}, Counts: map[string]int{},Next: []string{"The import could not start from its approved preview: " + err.Error() + ". Preview it again and start a new import."}})return err}diff --git a/app/backend/internal/migrate/plan_library.go b/app/backend/internal/migrate/plan_library.goindex 46401f8..4e3bfeb 100644--- a/app/backend/internal/migrate/plan_library.go+++ b/app/backend/internal/migrate/plan_library.go@@ -582,10 +582,16 @@ func (b *builder) titleList(s *Snapshot) {b.not(GroupTitles, from, name, "no "+map[string]string{"movie": "TMDB", "show": "TVDB or TMDB", "artist": "MusicBrainz"}[kind]+" id is known for it")continue}+ // Sorted, so the same read always keeps the same ten ids.+ idKeys := make([]string, 0, len(t.IDs))+ for k := range t.IDs {+ idKeys = append(idKeys, k)+ }+ sort.Strings(idKeys)ids := map[string]string{}- for k, v := range t.IDs {- if k = clip(k, 20); k != "" && len(ids) < 10 {- ids[k] = clip(v, 60)+ for _, k := range idKeys {+ if c := clip(k, 20); c != "" && len(ids) < 10 {+ ids[c] = clip(t.IDs[k], 60)}}music, issues := musicPolicy(s, t)diff --git a/app/backend/internal/migrate/plan_people.go b/app/backend/internal/migrate/plan_people.goindex 9dc05b6..88b7c40 100644--- a/app/backend/internal/migrate/plan_people.go+++ b/app/backend/internal/migrate/plan_people.go@@ -207,9 +207,11 @@ func (b *builder) asks(s *Snapshot) {}name := b.titles[kind+":"+ref]if name == "" {- for _, v := range ids {- if n := b.titles[kind+":ids:"+v]; n != "" {+ // In a fixed order, so the same read always gives the same name.+ for _, src := range []string{"tmdb", "tvdb", "imdb"} {+ if n := b.titles[kind+":ids:"+ids[src]]; ids[src] != "" && n != "" {name = n+ break}}}@@ -522,10 +524,30 @@ func metadataHost(raw string) bool {return h == "metadata" || strings.HasPrefix(h, "metadata.") || strings.HasPrefix(h, "instance-data")}-// PlanHash names a Plan exactly: a move starts only from the plan its dry-// run showed, and another one is refused (ErrPlanChanged).+// PlanHash names what a move would do: a move starts only from the plan+// its dry run showed, and another one is refused (ErrPlanChanged). It+// covers the read apps, the groups left out and each item's key and what+// it creates or changes; wording, source positions and the not-moved+// list are left out, so a harmless difference there does not refuse it.func PlanHash(p *Plan) string {- b, _ := json.Marshal(p)+ type group struct {+ Name string `json:"name"`+ Skipped bool `json:"skipped"`+ Items []Item `json:"items"`+ }+ approved := struct {+ Snapshots []int64 `json:"snapshots"`+ Groups []group `json:"groups"`+ }{Snapshots: p.Snapshots}+ for _, g := range p.Groups {+ items := make([]Item, 0, len(g.Items))+ for _, it := range g.Items {+ it.Name, it.From, it.Detail, it.Why = "", "", "", ""+ items = append(items, it)+ }+ approved.Groups = append(approved.Groups, group{Name: g.Name, Skipped: g.Skipped, Items: items})+ }+ b, _ := json.Marshal(approved)h := sha256.Sum256(b)return hex.EncodeToString(h[:])}diff --git a/app/backend/internal/migrate/plan_services.go b/app/backend/internal/migrate/plan_services.goindex b442366..29f6218 100644--- a/app/backend/internal/migrate/plan_services.go+++ b/app/backend/internal/migrate/plan_services.go@@ -180,12 +180,20 @@ func (b *builder) indexers(s *Snapshot) {}func anyKey(m map[string]any, key string) any {- for k, v := range m {- if strings.EqualFold(k, key) {- return v+ if v, ok := m[key]; ok {+ return v+ }+ // Keys that differ only in case: the smallest wins, every time.+ best, found := "", false+ for k := range m {+ if strings.EqualFold(k, key) && (!found || k < best) {+ best, found = k, true}}- return nil+ if !found {+ return nil+ }+ return m[best]}func hostURL(host string, port int, tls bool, base string) string {diff --git a/app/backend/internal/migrate/report.go b/app/backend/internal/migrate/report.goindex 5ed07bd..008acd1 100644--- a/app/backend/internal/migrate/report.go+++ b/app/backend/internal/migrate/report.go@@ -34,7 +34,9 @@ func (r *Report) Markdown() string {if r.Move != 0 {fmt.Fprintf(&b, "- Import: %d\n", r.Move)}- fmt.Fprintf(&b, "- When: %s\n", r.At.Format("2006-01-02 15:04 MST"))+ if !r.At.IsZero() {+ fmt.Fprintf(&b, "- When: %s\n", r.At.Format("2006-01-02 15:04 MST"))+ }if len(r.Apps) > 0 {fmt.Fprintf(&b, "- From: %s\n", strings.Join(r.Apps, ", "))}@@ -47,6 +49,10 @@ func (r *Report) Markdown() string {for _, k := range keys {parts = append(parts, fmt.Sprintf("%d %s", r.Counts[k], resultWords[k]))}+ if len(parts) == 0 {+ // A move that failed before it started has no items.+ parts = []string{"nothing was moved"}+ }fmt.Fprintf(&b, "- In short: %s\n\n", strings.Join(parts, ", "))b.WriteString("## What to do next\n\n")diff --git a/app/frontend/src/routes/settings/(home)/art.svelte.ts b/app/frontend/src/routes/settings/(home)/art.svelte.tsindex a0631fa..2bfd1f9 100644--- a/app/frontend/src/routes/settings/(home)/art.svelte.ts+++ b/app/frontend/src/routes/settings/(home)/art.svelte.ts@@ -35,6 +35,15 @@ export function startArt(member: number | undefined, mayUsers: boolean, self: Pe.then((titles) => {if (mine !== started) return;const posters = pickPosters(titles).map(small);+ if (posters.length) return posters;+ // An empty Library still gets a wall: this week's trending movies.+ return api+ .get<{ items?: { poster?: string }[] }>('/discover?row=trending&kind=movie')+ .then((r) => [...new Set((r.items ?? []).map((i) => i.poster ?? '').filter(Boolean))].slice(0, 16).map(small))+ .catch(() => [] as string[]);+ })+ .then((posters) => {+ if (mine !== started || !posters) return;if (posters.join() !== homeArt.posters.join()) homeArt.posters = posters;save(member, { posters: homeArt.posters, people: homeArt.people });})