Enhanced Genres parsing

This commit is contained in:
2026-02-05 03:04:42 +03:00
parent 332f15aa02
commit a59905073d

View File

@@ -75,7 +75,9 @@ public static class TagEditor {
if (albumResult != null)
{
IReleaseGroup fullAlbum = await query.LookupReleaseGroupAsync(albumResult.Id, Include.Genres);
file.Tag.Genres = fullAlbum.Genres?.Select(g => g.Name).ToArray();
file.Tag.Genres = fullAlbum.Genres?.Select(g =>
string.Join(" ", g.Name.Split(" ").Select(n => n[0].ToString().ToUpper() + n[1..^0]))
).ToArray();
}
}
catch { }
@@ -92,13 +94,13 @@ public static class TagEditor {
{
FileInfo path = new FileInfo(filePath);
Console.WriteLine(file.Tag.Album);
string album = ReplaceSystemSymbols(file.Tag.Album);
string album = file.Tag.Year + " — " + ReplaceSystemSymbols(file.Tag.Album);
if (!Directory.Exists(Path.Combine(path.DirectoryName!, album)))
Directory.CreateDirectory(Path.Combine(path.DirectoryName!, album));
string output = Path.Combine(path.DirectoryName!,
album,
$"{file.Tag.Track}. {string.Join(", ", file.Tag.Performers.Select(p => ReplaceSystemSymbols(p)))} - {file.Tag.Title}.{format}");
$"{file.Tag.Track}. {string.Join(", ", file.Tag.Performers.Select(p => ReplaceSystemSymbols(p)))} - {ReplaceSystemSymbols(file.Tag.Title)}.{format}");
if (System.IO.File.Exists(output))
System.IO.File.Delete(filePath);
@@ -113,23 +115,23 @@ public static class TagEditor {
string result = origin;
if (result.Contains("/"))
result.Replace("/", "-");
result = result.Replace("/", "-");
if (result.Contains(":"))
result.Replace(":", "-");
result = result.Replace(":", "-");
if (result.Contains("|"))
result.Replace("|", "-");
result = result.Replace("|", "-");
if (result.Contains("\\"))
result.Replace("\\", "-");
result = result.Replace("\\", "-");
if (result.Contains("?"))
result.Replace("?", "");
result = result.Replace("?", "");
if (result.Contains("\""))
result.Replace("\"", "_");
result = result.Replace("\"", "_");
if (result.Contains("*"))
result.Replace("*", "_");
result = result.Replace("*", "_");
if (result.Contains("<"))
result.Replace("<", "_");
result = result.Replace("<", "_");
if (result.Contains(">"))
result.Replace(">", "_");
result = result.Replace(">", "_");
return result;
}