release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m23s
release / go (push) Successful in 1m41s
release / integration (push) Successful in 5m20s
release / android (push) Successful in 5m28s
release / Build signed APK (releases and dev) (push) Successful in 5m30s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 27s
release / Verify release artifacts (tag releases only) (push) Skipped
- acquisition_settings.upgrade_until (default High quality lossy, Lidarr's cutoff, note #5527; "" is off), an "Upgrade until" row under Searching. - The wanted worker judges held albums hourly: tier per format from size per second (the scanner records no bitrate), the album's worst. Below the cutoff it is wanted for quality; a video rip among its tracks always. - The schedule searches upgrades weekly, after open wants; a release no better than the copy held is refused ("not_better"). - The import matches each file to the track it would replace (recording, then disc/track) and replaces it when it is a rip or the file is a better tier: over the same path in one rename, or filed beside it and the old track folded in (library.ReplaceTrack: file first, then foldTrackInto). Nothing better: the release is set aside. - Collection › Upgrades (Lidarr's Cutoff Unmet); Suspect sources says when a clean copy was looked for instead of Lidarr's search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.2 KiB
Go
54 lines
2.2 KiB
Go
package importer
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.fabledsword.com/bvandeusen/minstrel/internal/release"
|
|
)
|
|
|
|
func TestPlanUpgrade_ReplacesOnlyWhatItBetters(t *testing.T) {
|
|
plan := []Placement{
|
|
{File: 0, Dest: "/music/A/B (2001)/A - B - 01 - One.flac", Disc: 1, Track: 1, Recording: "rec-1"},
|
|
{File: 1, Dest: "/music/A/B (2001)/A - B - 02 - Two.mp3", Disc: 1, Track: 2},
|
|
{File: 2, Dest: "/music/A/B (2001)/A - B - 03 - Three.flac", Disc: 1, Track: 3},
|
|
{File: 3, Dest: "/music/A/B (2001)/A - B - 04 - Four.flac", Disc: 1, Track: 4},
|
|
{File: 4, Dest: "/music/A/B (2001)/A - B - 05 - Five.flac", Disc: 1, Track: 5},
|
|
}
|
|
newTiers := []release.Tier{release.TierLossless, release.TierLossyHigh, release.TierLossless,
|
|
release.TierLossless, release.TierLossyLow}
|
|
olds := []OldTrack{
|
|
// Matched by recording though its number is wrong: a 192 MP3.
|
|
{Path: "/music/A/B/01 One.mp3", Recording: "rec-1", Disc: 1, Track: 9, Format: "mp3", Bytes: 4_800_000, Ms: 200_000},
|
|
// Same path as the new file, a 320 MP3: the new 320 is no better.
|
|
{Path: "/music/A/B (2001)/A - B - 02 - Two.mp3", Disc: 1, Track: 2, Format: "mp3", Bytes: 8_000_000, Ms: 200_000},
|
|
// Already lossless: kept.
|
|
{Path: "/music/A/B/03 Three.flac", Disc: 1, Track: 3, Format: "flac", Bytes: 22_000_000, Ms: 200_000},
|
|
// A video rip, even though lossless: replaced.
|
|
{Path: "/music/A/B/04 Four (Official Video).flac", Disc: 0, Track: 4, Format: "flac", Bytes: 22_000_000, Ms: 200_000, Rip: true},
|
|
}
|
|
steps := planUpgrade(plan, newTiers, olds)
|
|
want := []struct {
|
|
action string
|
|
old int
|
|
}{
|
|
{stepReplace, 0}, {stepKeep, 1}, {stepKeep, 2}, {stepReplace, 3}, {stepPlace, -1},
|
|
}
|
|
for i, w := range want {
|
|
if steps[i].Action != w.action || steps[i].Old != w.old {
|
|
t.Errorf("placement %d: %s old %d, want %s old %d", i, steps[i].Action, steps[i].Old, w.action, w.old)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestPlanUpgrade_OverwritesAWorseFileOnItsOwnPath(t *testing.T) {
|
|
dest := "/music/A/B (2001)/A - B - 01 - One.mp3"
|
|
steps := planUpgrade(
|
|
[]Placement{{File: 0, Dest: dest, Disc: 1, Track: 1}},
|
|
[]release.Tier{release.TierLossyHigh},
|
|
[]OldTrack{{Path: dest, Disc: 1, Track: 1, Format: "mp3", Bytes: 3_200_000, Ms: 200_000}}, // 128
|
|
)
|
|
if steps[0].Action != stepOverwrite || steps[0].Old != 0 {
|
|
t.Errorf("got %+v", steps[0])
|
|
}
|
|
}
|