Added support for chapter titles and refactored.

This commit is contained in:
Michael Bucari-Tovo 2021-06-16 16:58:01 -06:00
parent 9271114408
commit ff722b6a52
2 changed files with 8 additions and 13 deletions

View File

@ -14,20 +14,15 @@ namespace AaxDecrypter
stringBuilder.AppendLine(GetFileLine(filePath, "MP3"));
var beginningTimes = chapters.GetBeginningTimes().ToList();
for (var i = 0; i < beginningTimes.Count; i++)
var trackCount = 0;
foreach (Chapter c in chapters.ChapterList)
{
var chapter = i + 1;
trackCount++;
var startTime = TimeSpan.FromSeconds(c.StartTime);
var timeSpan = beginningTimes[i];
var minutes = Math.Floor(timeSpan.TotalMinutes).ToString();
var seconds = timeSpan.Seconds.ToString("D2");
var milliseconds = (timeSpan.Milliseconds / 10).ToString("D2");
var time = minutes + ":" + seconds + ":" + milliseconds;
stringBuilder.AppendLine($"TRACK {chapter} AUDIO");
stringBuilder.AppendLine($" TITLE \"Chapter {chapter:D2}\"");
stringBuilder.AppendLine($" INDEX 01 {time}");
stringBuilder.AppendLine($"TRACK {trackCount} AUDIO");
stringBuilder.AppendLine($" TITLE \"{c.Title}\"");
stringBuilder.AppendLine($" INDEX 01 {(int)startTime.TotalMinutes}:{startTime:ss\\:ff}");
}
return stringBuilder.ToString();

View File

@ -13,7 +13,7 @@
<!-- <PublishSingleFile>true</PublishSingleFile> -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Version>4.2.4.3</Version>
<Version>4.2.4.8</Version>
</PropertyGroup>
<ItemGroup>