Skip to content

Commit fb35843

Browse files
authored
Merge pull request #55 from OUCC/feat/#54
Feat/#54
2 parents 274fc3d + 04f04ec commit fb35843

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Epub/KoeBook.Epub/Services/EpubGenerateService.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public async ValueTask<string> GenerateEpubAsync(BookScripts bookScripts, string
2727
using var reader = new WaveFileReader(ms);
2828
var tmpMp3Path = Path.Combine(tempDirectory, $"{document.Title}{i}.mp3");
2929
MediaFoundationEncoder.EncodeToMp3(reader, tmpMp3Path);
30-
scriptLine.Audio = new Audio(reader.TotalTime, tmpMp3Path);
30+
using var mp3Stream = new Mp3FileReader(tmpMp3Path);
31+
scriptLine.Audio = new Audio(mp3Stream.TotalTime, tmpMp3Path);
3132
}
3233

3334
if (await _createService.TryCreateEpubAsync(document, tempDirectory, cancellationToken).ConfigureAwait(false))

KoeBook.Core/Services/ClaudeAnalyzerService.cs

+5
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,15 @@ private static (Character[], Dictionary<string, string>) ExtractCharacterList(st
174174
var voiceIdLine = zippedLine.First.AsSpan();
175175
voiceIdLine = voiceIdLine[(voiceIdLine.IndexOf(' ') + 2)..];//cまで無視
176176
voiceIdLine = voiceIdLine[..voiceIdLine.IndexOf(' ')];// 二人以上話す時には先頭のものを使う
177+
if (voiceIdLine[^1] == '.')// idに"."がつくことがあるので削除する
178+
{
179+
voiceIdLine = voiceIdLine[..^1];
180+
}
177181
if (characterId2Name.TryGetValue(voiceIdLine.ToString(), out var characterName))
178182
{
179183
zippedLine.Second.Character = characterName;
180184
}
185+
else { throw new EbookException(ExceptionType.ClaudeTalkerAndStyleSettingFailed); }
181186
return 0;
182187
}).Count();
183188
if (voiceIdLinesCount != scriptLines.Length)

0 commit comments

Comments
 (0)