refactor: track lengths and file sizes come from the shared formatters on Missing files, Duplicates, a want's Releases and the app download; an hour-long track reads 1:01:05, not 61:05 (M505 #5639 #5640)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 16:14:01 -04:00
co-authored by Claude Opus 5.5
parent 9e7d50b38e
commit 622f248ea2
7 changed files with 35 additions and 32 deletions
@@ -12,6 +12,7 @@
import { errMessage } from '#lib/api/errors.js';
import { pushToast } from '#lib/stores/toast.svelte.js';
import { relativeTime } from '#lib/utils/relativeTime.js';
import { formatDuration } from '#lib/media/duration.js';
import { coverUrl } from '#lib/media/covers.js';
import { needsYou, searched, wantStatus } from '#lib/wanted/wantStatus.js';
import WantCandidates from '#lib/components/WantCandidates.svelte';
@@ -43,12 +44,6 @@
return n === 1 ? '1 track' : `${n} tracks`;
}
function durationLabel(sec: number): string {
const m = Math.floor(sec / 60);
const s = sec % 60;
return `${m}:${s.toString().padStart(2, '0')}`;
}
// What happens to these is set under Acquisition (#5607); the line above
// the list says what it is now, since this is where the question comes up.
let policy = $state<ReacquisitionSettings | null>(null);
@@ -269,7 +264,7 @@
never played
{/if}
</span>
<span class="shrink-0 text-xs text-text-muted">{durationLabel(t.duration_sec)}</span>
<span class="shrink-0 text-xs text-text-muted" data-testid="missing-track-length">{formatDuration(t.duration_sec)}</span>
</li>
{/each}
</ul>