Update la web app pour tirer partie du nouveau systeme de cache
This commit is contained in:
@@ -102,6 +102,9 @@
|
||||
<span v-if="track.metadata?.bitrate">
|
||||
{{ formatBitrate(track.metadata.bitrate) }}
|
||||
</span>
|
||||
<span v-if="conversionLabel(track)">
|
||||
{{ conversionLabel(track) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="collection" v-if="track.collection">
|
||||
{{ track.collection }}
|
||||
@@ -153,6 +156,7 @@
|
||||
<p v-if="selectedTrack.metadata.sample_rate"><strong>Sample Rate:</strong> {{ formatSampleRate(selectedTrack.metadata.sample_rate) }}</p>
|
||||
<p v-if="selectedTrack.metadata.bitrate"><strong>Bitrate:</strong> {{ formatBitrate(selectedTrack.metadata.bitrate) }}</p>
|
||||
<p v-if="selectedTrack.metadata.channels"><strong>Channels:</strong> {{ selectedTrack.metadata.channels }}</p>
|
||||
<p v-if="conversionLabel(selectedTrack)"><strong>Conversion:</strong> {{ conversionLabel(selectedTrack) }}</p>
|
||||
</div>
|
||||
<div class="cache-section">
|
||||
<h4>Cache Info</h4>
|
||||
@@ -414,6 +418,37 @@ function formatDate(dateString: string) {
|
||||
return d.toLocaleDateString();
|
||||
}
|
||||
|
||||
function formatConversion(
|
||||
conversion?: { mode?: string; input_codec?: string; details?: string } | null
|
||||
): string | undefined {
|
||||
if (!conversion || !conversion.mode) return undefined;
|
||||
const modeLower = conversion.mode.toLowerCase();
|
||||
const modeLabel =
|
||||
modeLower === "passthrough"
|
||||
? "Passthrough"
|
||||
: modeLower === "transcode"
|
||||
? "Transcoded"
|
||||
: conversion.mode.charAt(0).toUpperCase() + conversion.mode.slice(1);
|
||||
|
||||
if (conversion.input_codec) {
|
||||
const codec = conversion.input_codec.toUpperCase();
|
||||
if (modeLower === "passthrough") {
|
||||
return `${modeLabel} (${codec})`;
|
||||
}
|
||||
return `${modeLabel} (${codec} → FLAC)`;
|
||||
}
|
||||
|
||||
if (conversion.details) {
|
||||
return `${modeLabel} – ${conversion.details}`;
|
||||
}
|
||||
|
||||
return modeLabel;
|
||||
}
|
||||
|
||||
function conversionLabel(track: AudioCacheEntry | null): string | undefined {
|
||||
return formatConversion(track?.metadata?.conversion ?? undefined);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
refreshTracks();
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ export interface AudioCacheMetadata {
|
||||
sample_rate?: number;
|
||||
bitrate?: number;
|
||||
channels?: number;
|
||||
conversion?: ConversionInfo;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
@@ -30,6 +31,12 @@ export interface AudioCacheEntry {
|
||||
metadata?: AudioCacheMetadata | null;
|
||||
}
|
||||
|
||||
export interface ConversionInfo {
|
||||
mode: string;
|
||||
input_codec?: string;
|
||||
details?: string;
|
||||
}
|
||||
|
||||
export interface AddTrackRequest {
|
||||
url: string;
|
||||
collection?: string;
|
||||
@@ -43,9 +50,13 @@ export interface AddTrackResponse {
|
||||
|
||||
export interface DownloadStatus {
|
||||
pk: string;
|
||||
status: "pending" | "downloading" | "completed" | "failed";
|
||||
progress?: number;
|
||||
in_progress: boolean;
|
||||
finished: boolean;
|
||||
current_size?: number;
|
||||
transformed_size?: number;
|
||||
expected_size?: number;
|
||||
error?: string;
|
||||
conversion?: ConversionInfo;
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
|
||||
Reference in New Issue
Block a user