mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-07 05:07:59 +02:00
feat: add M4A metadata/cover embed support across all Flutter screens
Add FFmpegService.embedMetadataToM4a() for writing tags and cover art into M4A files via FFmpeg. Fix two bugs in the same function: - Remove '-disposition:v:0 attached_pic' which is only valid for Matroska/WebM containers and causes FFmpeg to error on MP4/M4A - Apply same fix to _convertToAlac which had the identical issue Add M4A handling (isM4A branch) to all four embed call-sites: track_metadata_screen (lyrics embed, re-enrich, edit metadata sheet, format conversion), queue_tab, local_album_screen, and downloaded_album_screen. Add 'LYRICS'/'UNSYNCEDLYRICS' to _mapMetadataForTagEmbed so existing lyrics survive a re-enrich cycle on M4A/MP3/Opus files. Preserve existing lyrics before overwriting tags in the edit metadata sheet (best-effort readFileMetadata before FFmpeg pass). Extract mergePlatformMetadataForTagEmbed() into lyrics_metadata_helper to deduplicate the identical metadata-mapping loops that existed in queue_tab, local_album_screen, downloaded_album_screen, and track_metadata_screen. Wire ensureLyricsMetadataForConversion into the format conversion path in track_metadata_screen so lyrics are carried through conversions. Add ISRC and LABEL/ORGANIZATION mappings to _convertToM4aTags.
This commit is contained in:
@@ -74,3 +74,38 @@ Future<void> ensureLyricsMetadataForConversion({
|
||||
metadata['LYRICS'] = lyrics;
|
||||
metadata['UNSYNCEDLYRICS'] = lyrics;
|
||||
}
|
||||
|
||||
void mergePlatformMetadataForTagEmbed({
|
||||
required Map<String, String> target,
|
||||
required Map<String, dynamic> source,
|
||||
}) {
|
||||
void put(String key, dynamic value) {
|
||||
final normalized = value?.toString().trim();
|
||||
if (normalized == null || normalized.isEmpty) return;
|
||||
target[key] = normalized;
|
||||
}
|
||||
|
||||
put('TITLE', source['title']);
|
||||
put('ARTIST', source['artist']);
|
||||
put('ALBUM', source['album']);
|
||||
put('ALBUMARTIST', source['album_artist']);
|
||||
put('DATE', source['date']);
|
||||
put('ISRC', source['isrc']);
|
||||
put('GENRE', source['genre']);
|
||||
put('ORGANIZATION', source['label']);
|
||||
put('COPYRIGHT', source['copyright']);
|
||||
put('COMPOSER', source['composer']);
|
||||
put('COMMENT', source['comment']);
|
||||
put('LYRICS', source['lyrics']);
|
||||
put('UNSYNCEDLYRICS', source['lyrics']);
|
||||
|
||||
final trackNumber = source['track_number'];
|
||||
if (trackNumber != null && trackNumber.toString() != '0') {
|
||||
put('TRACKNUMBER', trackNumber);
|
||||
}
|
||||
|
||||
final discNumber = source['disc_number'];
|
||||
if (discNumber != null && discNumber.toString() != '0') {
|
||||
put('DISCNUMBER', discNumber);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user