mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-02 16:20:57 +02:00
fix(download): preserve finalization metadata and library labels
This commit is contained in:
@@ -69,6 +69,10 @@ String? audioFormatForPath(String? filePath, {String? fileName}) {
|
||||
final candidates = <String>[?filePath, ?fileName];
|
||||
for (final candidate in candidates) {
|
||||
final lower = candidate.trim().toLowerCase();
|
||||
if (lower.endsWith('.flac')) return 'FLAC';
|
||||
if (lower.endsWith('.alac')) return 'ALAC';
|
||||
if (lower.endsWith('.wav')) return 'WAV';
|
||||
if (lower.endsWith('.aiff') || lower.endsWith('.aif')) return 'AIFF';
|
||||
if (lower.endsWith('.opus') || lower.endsWith('.ogg')) return 'OPUS';
|
||||
if (lower.endsWith('.mp3')) return 'MP3';
|
||||
if (lower.endsWith('.aac')) return 'AAC';
|
||||
@@ -153,6 +157,17 @@ bool isLossyAudioFormat(String? value) {
|
||||
}.contains(normalizeAudioFormatValue(value));
|
||||
}
|
||||
|
||||
/// Whether a reported codec value only identifies the ISO-BMFF container.
|
||||
/// `m4a`/`mp4` cannot tell callers whether the audio stream is AAC, ALAC,
|
||||
/// FLAC, or another codec, so an explicit conversion request must probe or
|
||||
/// attempt conversion instead of classifying it as known-lossy audio.
|
||||
bool isInconclusiveAudioCodec(String? value) {
|
||||
final raw = normalizeOptionalString(value);
|
||||
if (raw == null) return true;
|
||||
final normalized = raw.toLowerCase().replaceAll('-', '_');
|
||||
return normalized == 'm4a' || normalized == 'mp4';
|
||||
}
|
||||
|
||||
/// Returns a provider-independent quality label suitable for a filename.
|
||||
///
|
||||
/// Requested labels such as LOSSLESS and HI_RES are intentionally ignored:
|
||||
|
||||
Reference in New Issue
Block a user