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")); stringBuilder.AppendLine(GetFileLine(filePath, "MP3"));
var beginningTimes = chapters.GetBeginningTimes().ToList(); var trackCount = 0;
for (var i = 0; i < beginningTimes.Count; i++) foreach (Chapter c in chapters.ChapterList)
{ {
var chapter = i + 1; trackCount++;
var startTime = TimeSpan.FromSeconds(c.StartTime);
var timeSpan = beginningTimes[i]; stringBuilder.AppendLine($"TRACK {trackCount} AUDIO");
var minutes = Math.Floor(timeSpan.TotalMinutes).ToString(); stringBuilder.AppendLine($" TITLE \"{c.Title}\"");
var seconds = timeSpan.Seconds.ToString("D2"); stringBuilder.AppendLine($" INDEX 01 {(int)startTime.TotalMinutes}:{startTime:ss\\:ff}");
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}");
} }
return stringBuilder.ToString(); return stringBuilder.ToString();

View File

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