// Die Platz-Prüfung vor dem Rip (5.5.0) — EINE Rechnung für Kern und // Fenster: Roh plus geschätzt 25 % für die Kompression, plus 2 GB Luft. // Der Kern urteilt beim Start (index.ts ripMitPlatz — auch für die // Automatik), der Dialog zeigt dasselbe Urteil schon vor dem Klick // (TitelWahlDialog). export const PLATZ_LUFT_BYTES = 2e9 export const KOMPRESSION_ANTEIL = 0.25 export interface PlatzUrteil { /** Leer, wenn der Platz reicht — sonst der Grund in Klartext. */ text: string /** true: nicht einmal der verlustfreie Rip passt — der Start wird verweigert. */ hart: boolean } export function gbText(bytes: number): string { return `${(bytes / 1e9).toFixed(1).replace('.', ',')} GB` } export function platzUrteil(freiBytes: number, rohBytes: number, komprimiert: boolean): PlatzUrteil { const noetig = rohBytes + (komprimiert ? rohBytes * KOMPRESSION_ANTEIL : 0) + PLATZ_LUFT_BYTES if (freiBytes >= noetig) return { text: '', hart: false } if (freiBytes < rohBytes + PLATZ_LUFT_BYTES) { return { text: `Zu wenig Platz: ${gbText(freiBytes)} frei, der Rip braucht ${gbText(rohBytes)} verlustfrei. Das geht schief — erst Platz schaffen (Einstellungen → Roh-Dateien).`, hart: true, } } return { text: `Knapp: ${gbText(freiBytes)} frei, gebraucht werden etwa ${gbText(noetig)} (Roh plus Kompression). Aufräumen unter Roh-Dateien hilft.`, hart: false, } }