Skip to content

Commit

Permalink
Merge branch 'main' into feat/#41
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed May 3, 2024
2 parents 8c993e4 + fb35843 commit d9130ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Epub/KoeBook.Epub/Services/EpubGenerateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public async ValueTask<string> GenerateEpubAsync(BookScripts bookScripts, string
using var reader = new WaveFileReader(ms);
var tmpMp3Path = Path.Combine(tempDirectory, $"{document.Title}{i}.mp3");
MediaFoundationEncoder.EncodeToMp3(reader, tmpMp3Path);
scriptLine.Audio = new Audio(reader.TotalTime, tmpMp3Path);
using var mp3Stream = new Mp3FileReader(tmpMp3Path);
scriptLine.Audio = new Audio(mp3Stream.TotalTime, tmpMp3Path);
}

if (await _createService.TryCreateEpubAsync(document, tempDirectory, cancellationToken).ConfigureAwait(false))
Expand Down
5 changes: 5 additions & 0 deletions KoeBook.Core/Services/ClaudeAnalyzerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ private static (Character[], Dictionary<string, string>) ExtractCharacterList(st
var voiceIdLine = zippedLine.First.AsSpan();
voiceIdLine = voiceIdLine[(voiceIdLine.IndexOf(' ') + 2)..];//cまで無視
voiceIdLine = voiceIdLine[..voiceIdLine.IndexOf(' ')];// 二人以上話す時には先頭のものを使う
if (voiceIdLine[^1] == '.')// idに"."がつくことがあるので削除する
{
voiceIdLine = voiceIdLine[..^1];
}
if (characterId2Name.TryGetValue(voiceIdLine.ToString(), out var characterName))
{
zippedLine.Second.Character = characterName;
}
else { throw new EbookException(ExceptionType.ClaudeTalkerAndStyleSettingFailed); }
return 0;
}).Count();
if (voiceIdLinesCount != scriptLines.Length)
Expand Down

0 comments on commit d9130ba

Please sign in to comment.