Better handle multiple tags respecting US format (#878)

* Better handle multiple tags respecting US format

Based on unversioned, V1 & V2 of US formats : https://github.com/UltraStar-Deluxe/format
Should address #623
Creator now takes multiple values
Maintain backward compatibility

* Update file path properties to match US formats
This commit is contained in:
Quentin Bray authored and GitHub committed 2026-06-23 21:04:59 +02:00
1 parent cae67eb4ab
commit 1bba340cf8
10 files changed
+97 -160

No files matched your search

+17 -22
View File
@@ -66,17 +66,13 @@ namespace VocaluxeLib.Songs
}
}
private void _WriteHeaderEntrys(string id, ICollection<string> value)
private void _WriteHeaderEntries(string id, ICollection<string> value)
{
if (value == null || value.Count <= 0)
if (value is not { Count: > 0 })
{
return;
}
foreach (var val in value)
{
_WriteHeaderEntry(id, val);
}
_WriteHeaderEntry(id, string.Join(",", value));
}
private void _WriteHeader()
@@ -86,16 +82,10 @@ namespace VocaluxeLib.Songs
_WriteHeaderEntry("ENCODING", _Song.Encoding.GetEncodingName());
}
_WriteHeaderEntry("CREATOR", _Song.Creator);
_WriteHeaderEntry("VERSION", _Song.Version);
_WriteHeaderEntry("LENGTH", _Song.Length);
_WriteHeaderEntry("SOURCE", _Song.Source);
if (!string.IsNullOrEmpty(_Song._Comment))
{
var comment = _Song._Comment.Replace("\r\n", "\n").Replace('\r', '\n');
char[] splitChar = { '\n' };
_WriteHeaderEntrys("COMMENT", comment.Split(splitChar));
}
_WriteHeaderEntry("COMMENT", _Song._Comment);
_WriteHeaderEntry("TITLE", _Song.Title);
_WriteHeaderEntry("ARTIST", _Song.Artist);
@@ -109,16 +99,21 @@ namespace VocaluxeLib.Songs
_WriteHeaderEntry("ARTIST-ON-SORTING", _Song.ArtistSorting);
}
_WriteHeaderEntrys("EDITION", _Song.Editions);
_WriteHeaderEntrys("GENRE", _Song.Genres);
_WriteHeaderEntry("TAGS", String.Join(",", _Song.Tags.ToArray()));
_WriteHeaderEntrys("LANGUAGE", _Song.Languages);
_WriteHeaderEntries("CREATOR", _Song.Creators);
_WriteHeaderEntries("EDITION", _Song.Editions);
_WriteHeaderEntries("GENRE", _Song.Genres);
_WriteHeaderEntries("TAGS", _Song.Tags);
_WriteHeaderEntries("LANGUAGE", _Song.Languages);
_WriteHeaderEntry("ALBUM", _Song.Album);
_WriteHeaderEntry("YEAR", _Song.Year);
_WriteHeaderEntry("MP3", _Song.MP3FileName);
_WriteHeaderEntry("COVER", _Song.CoverFileName);
_WriteHeaderEntrys("BACKGROUND", _Song.BackgroundFileNames);
_WriteHeaderEntry("VIDEO", _Song.VideoFileName);
_WriteHeaderEntry("MP3", _Song.Audio);
_WriteHeaderEntry("COVER", _Song.Cover);
// This is a custom behaviour, normally multiple backgrounds is not supported in official US format
foreach (var songBackgroundFileName in _Song.BackgroundFileNames)
{
_WriteHeaderEntry("BACKGROUND", songBackgroundFileName);
}
_WriteHeaderEntry("VIDEO", _Song.Video);
_WriteHeaderEntry("VIDEOGAP", _Song.VideoGap);
if (_Song.VideoAspect != EAspect.Crop)
{