From c7e9749ce4103ea4db5788c35c9057a96b812b21 Mon Sep 17 00:00:00 2001 From: zarzet Date: Thu, 2 Apr 2026 19:44:37 +0700 Subject: [PATCH] fix: resolve label and copyright from file metadata on info screen The info screen was not reading label/copyright from the actual file metadata, so these fields were always empty for local library items and download history items that lacked them in-memory. Now _resolveAudioMetadata() extracts and displays them without requiring a manual save first. --- lib/screens/track_metadata_screen.dart | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/screens/track_metadata_screen.dart b/lib/screens/track_metadata_screen.dart index 7e263403..d3d97132 100644 --- a/lib/screens/track_metadata_screen.dart +++ b/lib/screens/track_metadata_screen.dart @@ -317,6 +317,19 @@ class _TrackMetadataScreenState extends ConsumerState { resolvedDuration > 0 && (duration == null || duration == 0); + // Resolve label/copyright from file when the model doesn't carry them + // (e.g. local library items, or download history items without these fields). + final resolvedLabel = metadata['label']?.toString(); + final resolvedCopyright = metadata['copyright']?.toString(); + final needsLabel = + resolvedLabel != null && + resolvedLabel.isNotEmpty && + (label == null || label!.isEmpty); + final needsCopyright = + resolvedCopyright != null && + resolvedCopyright.isNotEmpty && + (copyright == null || copyright!.isEmpty); + final shouldPersistResolvedAudioMetadata = resolvedBitDepth != null || resolvedSampleRate != null || @@ -326,6 +339,8 @@ class _TrackMetadataScreenState extends ConsumerState { resolvedSampleRate != null || needsAlbum || needsDuration || + needsLabel || + needsCopyright || isPlaceholderQualityLabel(_quality)) && mounted) { setState(() { @@ -337,6 +352,8 @@ class _TrackMetadataScreenState extends ConsumerState { if (resolvedSampleRate != null) 'sample_rate': resolvedSampleRate, if (needsAlbum) 'album': resolvedAlbum, if (needsDuration) 'duration': resolvedDuration, + if (needsLabel) 'label': resolvedLabel, + if (needsCopyright) 'copyright': resolvedCopyright, }; }); }