From cbbbb663ac794be516b8cd2a0cab786a055eb64c Mon Sep 17 00:00:00 2001 From: TakenPt Date: Thu, 2 May 2024 23:02:18 +0900 Subject: [PATCH 1/6] =?UTF-8?q?#51=20=E9=9F=B3=E5=A3=B0=E5=90=88=E6=88=90?= =?UTF-8?q?=E3=81=AB=E3=81=8B=E3=81=91=E3=82=8B=E6=96=87=E5=AD=97=E6=95=B0?= =?UTF-8?q?=E3=82=92=E5=88=B6=E9=99=90=E3=81=99=E3=82=8B=EF=BC=86wav?= =?UTF-8?q?=E3=81=8B=E3=82=89mp3=E3=81=B8=E5=A4=89=E6=8F=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/EpubGenerateService.cs | 10 +- .../Services/SoundGenerationService.cs | 94 +++++++++++++++++-- 2 files changed, 96 insertions(+), 8 deletions(-) diff --git a/Epub/KoeBook.Epub/Services/EpubGenerateService.cs b/Epub/KoeBook.Epub/Services/EpubGenerateService.cs index a2a2461..9b5f58a 100644 --- a/Epub/KoeBook.Epub/Services/EpubGenerateService.cs +++ b/Epub/KoeBook.Epub/Services/EpubGenerateService.cs @@ -3,6 +3,7 @@ using KoeBook.Core.Models; using KoeBook.Epub.Contracts.Services; using KoeBook.Epub.Models; +using NAudio.Wave; namespace KoeBook.Epub.Services; @@ -17,10 +18,17 @@ public async ValueTask GenerateEpubAsync(BookScripts bookScripts, string cancellationToken.ThrowIfCancellationRequested(); var document = _documentStoreService.Documents.Single(d => d.Id == bookScripts.BookProperties.Id); + var tmpMp3Path = Path.Combine(tempDirectory, "temp.mp3"); foreach (var scriptLine in bookScripts.ScriptLines) { - scriptLine.Audio = new Audio(await _soundGenerationService.GenerateLineSoundAsync(scriptLine, bookScripts.Options, cancellationToken).ConfigureAwait(false)); + var wavData = await _soundGenerationService.GenerateLineSoundAsync(scriptLine, bookScripts.Options, cancellationToken).ConfigureAwait(false); + var ms = new MemoryStream(); + ms.Write(wavData); + ms.Position = 0; + using var reader = new WaveFileReader(ms); + MediaFoundationEncoder.EncodeToMp3(reader, tmpMp3Path); + scriptLine.Audio = new Audio(File.ReadAllBytes(tmpMp3Path)); } if (await _createService.TryCreateEpubAsync(document, tempDirectory, cancellationToken).ConfigureAwait(false)) diff --git a/KoeBook.Core/Services/SoundGenerationService.cs b/KoeBook.Core/Services/SoundGenerationService.cs index 350ab6b..991902a 100644 --- a/KoeBook.Core/Services/SoundGenerationService.cs +++ b/KoeBook.Core/Services/SoundGenerationService.cs @@ -1,6 +1,10 @@ -using System.Web; +using System.Buffers; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Web; using KoeBook.Core.Contracts.Services; using KoeBook.Core.Models; +using NAudio.Wave; namespace KoeBook.Core.Services; @@ -17,11 +21,87 @@ public async ValueTask GenerateLineSoundAsync(ScriptLine scriptLine, Boo var soundModel = _soundGenerationSelectorService.Models.FirstOrDefault(m => m.Name == model) ?? throw new EbookException(ExceptionType.SoundGenerationFailed); var style = soundModel.Styles.Contains(scriptLine.Style) ? scriptLine.Style : soundModel.Styles[0]; - var queryCollection = HttpUtility.ParseQueryString(string.Empty); - queryCollection.Add("text", scriptLine.Text); - queryCollection.Add("model_id", soundModel.Id); - queryCollection.Add("style", style); - return await _styleBertVitsClientService - .GetAsByteArrayAsync($"/voice?{queryCollection}", ExceptionType.SoundGenerationFailed, cancellationToken).ConfigureAwait(false); + using var msWriter = new MemoryStream(); + WaveFileWriter? writer = null; + byte[] dataBuffer = ArrayPool.Shared.Rent(1024); + try + { + await foreach (var voice in GenerateSoundAsync(scriptLine.Text, style, soundModel.Id, cancellationToken)) + { + if (voice.Length > dataBuffer.Length) + { + ArrayPool.Shared.Return(dataBuffer); + dataBuffer = ArrayPool.Shared.Rent(voice.Length); + } + using var msReader = new MemoryStream(); + await msReader.WriteAsync(voice, cancellationToken); + msReader.Position = 0; + using var reader = new WaveFileReader(msReader); + var read = await reader.ReadAsync(dataBuffer, cancellationToken); + if (writer is null) + { + writer = new WaveFileWriter(msWriter, reader.WaveFormat); + } + await writer.WriteAsync(dataBuffer.AsMemory()[..read], cancellationToken); + } + if (writer is null) + { + throw new EbookException(ExceptionType.SoundGenerationFailed); + } + await writer.FlushAsync(cancellationToken); + return msWriter.ToArray(); + } + catch { throw; } + finally + { + ArrayPool.Shared?.Return(dataBuffer); + writer?.Dispose(); + } + } + + private async IAsyncEnumerable GenerateSoundAsync(string text, string style, string modelId, [EnumeratorCancellation] CancellationToken cancellationToken) + { + foreach (var l in SplitPeriod(text, 300)) + { + var queryCollection = HttpUtility.ParseQueryString(string.Empty); + queryCollection.Add("text", l); + queryCollection.Add("model_id", modelId); + queryCollection.Add("style", style); + yield return await _styleBertVitsClientService + .GetAsByteArrayAsync($"/voice?{queryCollection}", ExceptionType.SoundGenerationFailed, cancellationToken).ConfigureAwait(false); + } + } + + private IEnumerable SplitPeriod(string text, int limit) + { + if (text.Length < limit) + { + yield return text; + } + else + { + List periodList = [0]; + var textSpan = text.AsSpan(); + var chunk = textSpan[..limit]; + while (true) + { + var periodIndex = periodList[^1] + chunk.LastIndexOf('。') + 1; + periodList.Add(periodIndex); + var nextEnd = periodIndex + limit; + if (nextEnd < textSpan.Length) + { + chunk = textSpan[periodIndex..nextEnd]; + } + else + { + periodList.Add(textSpan.Length); + break; + } + } + for (var i = 1; i < periodList.Count; i++) + { + yield return text[periodList[i - 1]..periodList[i]]; + } + } } } From acccb503d942b9a0ed09e81e40036834b6c180fd Mon Sep 17 00:00:00 2001 From: TakenPt Date: Thu, 2 May 2024 23:12:43 +0900 Subject: [PATCH 2/6] =?UTF-8?q?#51=20=E7=94=9F=E6=88=90=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=AE=E5=86=8D=E5=88=A9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/EpubGenerateService.cs | 7 ++++--- KoeBook.Core/Models/Audio.cs | 21 +++++-------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/Epub/KoeBook.Epub/Services/EpubGenerateService.cs b/Epub/KoeBook.Epub/Services/EpubGenerateService.cs index 9b5f58a..4c91af4 100644 --- a/Epub/KoeBook.Epub/Services/EpubGenerateService.cs +++ b/Epub/KoeBook.Epub/Services/EpubGenerateService.cs @@ -18,17 +18,18 @@ public async ValueTask GenerateEpubAsync(BookScripts bookScripts, string cancellationToken.ThrowIfCancellationRequested(); var document = _documentStoreService.Documents.Single(d => d.Id == bookScripts.BookProperties.Id); - var tmpMp3Path = Path.Combine(tempDirectory, "temp.mp3"); - foreach (var scriptLine in bookScripts.ScriptLines) + for (var i = 0; i < bookScripts.ScriptLines.Length; i++) { + var scriptLine = bookScripts.ScriptLines[i]; var wavData = await _soundGenerationService.GenerateLineSoundAsync(scriptLine, bookScripts.Options, cancellationToken).ConfigureAwait(false); var ms = new MemoryStream(); ms.Write(wavData); ms.Position = 0; using var reader = new WaveFileReader(ms); + var tmpMp3Path = Path.Combine(tempDirectory, $"{document.Title}{i}.mp3"); MediaFoundationEncoder.EncodeToMp3(reader, tmpMp3Path); - scriptLine.Audio = new Audio(File.ReadAllBytes(tmpMp3Path)); + scriptLine.Audio = new Audio(reader.TotalTime, tmpMp3Path); } if (await _createService.TryCreateEpubAsync(document, tempDirectory, cancellationToken).ConfigureAwait(false)) diff --git a/KoeBook.Core/Models/Audio.cs b/KoeBook.Core/Models/Audio.cs index 1afda6d..d100060 100644 --- a/KoeBook.Core/Models/Audio.cs +++ b/KoeBook.Core/Models/Audio.cs @@ -2,24 +2,13 @@ namespace KoeBook.Epub.Models; -public sealed class Audio +public sealed class Audio(TimeSpan totalTIme, string tempFilePath) { - public TimeSpan TotalTime { get; } - private readonly byte[] _mp3Data; + public TimeSpan TotalTime { get; } = totalTIme; + public string TempFilePath { get; } = tempFilePath; - public Audio(byte[] mp3Data) + public FileStream GetStream() { - _mp3Data = mp3Data; - using var ms = new MemoryStream(); - ms.Write(_mp3Data.AsSpan()); - ms.Flush(); - ms.Position = 0; - using var reader = new Mp3FileReader(ms); - TotalTime = reader.TotalTime; - } - - public MemoryStream GetStream() - { - return new MemoryStream(_mp3Data); + return File.OpenRead(TempFilePath); } } From 0b333f2d6384f0bc33f9126f314164c91b59850b Mon Sep 17 00:00:00 2001 From: aiueo-1234 <130837816+aiueo-1234@users.noreply.github.com> Date: Fri, 3 May 2024 00:54:09 +0900 Subject: [PATCH 3/6] =?UTF-8?q?#51=20=E3=82=AB=E3=83=90=E3=83=BC=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE=E3=83=91=E3=82=B9=E4=BB=A3?= =?UTF-8?q?=E5=85=A5=E5=BF=98=E3=82=8C=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Epub/KoeBook.Epub/Services/AnalyzerService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Epub/KoeBook.Epub/Services/AnalyzerService.cs b/Epub/KoeBook.Epub/Services/AnalyzerService.cs index a61f9b6..0f44093 100644 --- a/Epub/KoeBook.Epub/Services/AnalyzerService.cs +++ b/Epub/KoeBook.Epub/Services/AnalyzerService.cs @@ -45,6 +45,7 @@ public async ValueTask AnalyzeAsync(BookProperties bookProperties, } _createCoverFileService.Create(document.Title, document.Author, coverFilePath); + document.CoverFilePath = coverFilePath; } catch (EbookException) { throw; } catch (Exception ex) From a984402ca611c40ee9da391ec637b4596057b837 Mon Sep 17 00:00:00 2001 From: aiueo-1234 <130837816+aiueo-1234@users.noreply.github.com> Date: Fri, 3 May 2024 10:54:50 +0900 Subject: [PATCH 4/6] =?UTF-8?q?#51=20coverfilepath=E3=81=AE=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contracts/Services/IScraperSelectorService.cs | 2 +- Epub/KoeBook.Epub/Contracts/Services/IScrapingService.cs | 2 +- Epub/KoeBook.Epub/Models/EpubDocument.cs | 2 +- Epub/KoeBook.Epub/Services/AiStoryAnalyzerService.cs | 2 +- Epub/KoeBook.Epub/Services/AnalyzerService.cs | 2 +- Epub/KoeBook.Epub/Services/ScraperSelectorService.cs | 4 ++-- Epub/KoeBook.Epub/Services/ScrapingAozoraService.cs | 4 ++-- Epub/KoeBook.Epub/Services/ScrapingNaroService.cs | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Epub/KoeBook.Epub/Contracts/Services/IScraperSelectorService.cs b/Epub/KoeBook.Epub/Contracts/Services/IScraperSelectorService.cs index 9ce217c..f0be6e6 100644 --- a/Epub/KoeBook.Epub/Contracts/Services/IScraperSelectorService.cs +++ b/Epub/KoeBook.Epub/Contracts/Services/IScraperSelectorService.cs @@ -12,5 +12,5 @@ public interface IScraperSelectorService /// public bool IsMatchSites(string url); - public ValueTask ScrapingAsync(string url, string coverFillePath, string tempDirectory, Guid id, CancellationToken ct); + public ValueTask ScrapingAsync(string url, string tempDirectory, Guid id, CancellationToken ct); } diff --git a/Epub/KoeBook.Epub/Contracts/Services/IScrapingService.cs b/Epub/KoeBook.Epub/Contracts/Services/IScrapingService.cs index 91ffa29..0ff6fb8 100644 --- a/Epub/KoeBook.Epub/Contracts/Services/IScrapingService.cs +++ b/Epub/KoeBook.Epub/Contracts/Services/IScrapingService.cs @@ -6,5 +6,5 @@ public interface IScrapingService { public bool IsMatchSite(Uri url); - public ValueTask ScrapingAsync(string url, string coverFillePath, string tempDirectory, Guid id, CancellationToken ct); + public ValueTask ScrapingAsync(string url, string tempDirectory, Guid id, CancellationToken ct); } diff --git a/Epub/KoeBook.Epub/Models/EpubDocument.cs b/Epub/KoeBook.Epub/Models/EpubDocument.cs index 542699f..ec2ad9c 100644 --- a/Epub/KoeBook.Epub/Models/EpubDocument.cs +++ b/Epub/KoeBook.Epub/Models/EpubDocument.cs @@ -4,7 +4,7 @@ namespace KoeBook.Epub.Models; -public class EpubDocument(string title, string author, string coverFilePath, Guid id) +public class EpubDocument(string title, string author, Guid id, string coverFilePath = "") { public string Title { get; set; } = title; public string Author { get; set; } = author; diff --git a/Epub/KoeBook.Epub/Services/AiStoryAnalyzerService.cs b/Epub/KoeBook.Epub/Services/AiStoryAnalyzerService.cs index 80ddb85..e2166f7 100644 --- a/Epub/KoeBook.Epub/Services/AiStoryAnalyzerService.cs +++ b/Epub/KoeBook.Epub/Services/AiStoryAnalyzerService.cs @@ -11,7 +11,7 @@ public partial class AiStoryAnalyzerService(ISplitBraceService splitBraceService public EpubDocument CreateEpubDocument(AiStory aiStory, Guid id) { - return new EpubDocument(aiStory.Title, "AI", "", id) + return new EpubDocument(aiStory.Title, "AI", id) { Chapters = [new Chapter() { diff --git a/Epub/KoeBook.Epub/Services/AnalyzerService.cs b/Epub/KoeBook.Epub/Services/AnalyzerService.cs index 0f44093..7a81f90 100644 --- a/Epub/KoeBook.Epub/Services/AnalyzerService.cs +++ b/Epub/KoeBook.Epub/Services/AnalyzerService.cs @@ -34,7 +34,7 @@ public async ValueTask AnalyzeAsync(BookProperties bookProperties, switch (bookProperties) { case { SourceType: SourceType.Url or SourceType.FilePath, Source: string uri }: - document = await _scrapingService.ScrapingAsync(uri, coverFilePath, tempDirectory, bookProperties.Id, cancellationToken); + document = await _scrapingService.ScrapingAsync(uri, tempDirectory, bookProperties.Id, cancellationToken); break; case { SourceType: SourceType.AiStory, Source: AiStory aiStory }: document = _aiStoryAnalyzerService.CreateEpubDocument(aiStory, bookProperties.Id); diff --git a/Epub/KoeBook.Epub/Services/ScraperSelectorService.cs b/Epub/KoeBook.Epub/Services/ScraperSelectorService.cs index cf08e79..46d691e 100644 --- a/Epub/KoeBook.Epub/Services/ScraperSelectorService.cs +++ b/Epub/KoeBook.Epub/Services/ScraperSelectorService.cs @@ -21,14 +21,14 @@ public bool IsMatchSites(string url) } } - public async ValueTask ScrapingAsync(string url, string coverFillePath, string tempDirectory, Guid id, CancellationToken ct) + public async ValueTask ScrapingAsync(string url, string tempDirectory, Guid id, CancellationToken ct) { var uri = new Uri(url); foreach (var service in _scrapingServices) { if (service.IsMatchSite(uri)) - return await service.ScrapingAsync(url, coverFillePath, tempDirectory, id, ct); + return await service.ScrapingAsync(url, tempDirectory, id, ct); } throw new ArgumentException("対応するURLではありません"); diff --git a/Epub/KoeBook.Epub/Services/ScrapingAozoraService.cs b/Epub/KoeBook.Epub/Services/ScrapingAozoraService.cs index 297373d..b6bef42 100644 --- a/Epub/KoeBook.Epub/Services/ScrapingAozoraService.cs +++ b/Epub/KoeBook.Epub/Services/ScrapingAozoraService.cs @@ -22,7 +22,7 @@ public bool IsMatchSite(Uri uri) return uri.Host == "www.aozora.gr.jp"; } - public async ValueTask ScrapingAsync(string url, string coverFilePath, string imageDirectory, Guid id, CancellationToken ct) + public async ValueTask ScrapingAsync(string url, string imageDirectory, Guid id, CancellationToken ct) { var config = Configuration.Default.WithDefaultLoader(); using var context = BrowsingContext.New(config); @@ -37,7 +37,7 @@ public async ValueTask ScrapingAsync(string url, string coverFileP ?? throw new EbookException(ExceptionType.WebScrapingFailed, $"著者の取得に失敗しました。\n以下のリンクから正しい小説のリンクを取得してください。\n{GetCardUrl(url)}"); // EpubDocument の生成 - var document = new EpubDocument(TextReplace(bookTitle.InnerHtml), TextReplace(bookAuther.InnerHtml), coverFilePath, id); + var document = new EpubDocument(TextReplace(bookTitle.InnerHtml), TextReplace(bookAuther.InnerHtml), id); var (contentsIds, hasChapter, hasSection) = LoadToc(doc, document); diff --git a/Epub/KoeBook.Epub/Services/ScrapingNaroService.cs b/Epub/KoeBook.Epub/Services/ScrapingNaroService.cs index 6741549..a3fc124 100644 --- a/Epub/KoeBook.Epub/Services/ScrapingNaroService.cs +++ b/Epub/KoeBook.Epub/Services/ScrapingNaroService.cs @@ -25,7 +25,7 @@ public bool IsMatchSite(Uri uri) return uri.Host == "ncode.syosetu.com"; } - public async ValueTask ScrapingAsync(string url, string coverFilePath, string imageDirectory, Guid id, CancellationToken ct) + public async ValueTask ScrapingAsync(string url, string imageDirectory, Guid id, CancellationToken ct) { var ncode = GetNcode(url); var novelInfo = await GetNovelInfoAsync(ncode, ct).ConfigureAwait(false); @@ -53,7 +53,7 @@ public async ValueTask ScrapingAsync(string url, string coverFileP ? bookAuthorTag.InnerHtml : bookAuthorElement.InnerHtml.Replace("作者:", ""); - var document = new EpubDocument(bookTitle, bookAuthor, coverFilePath, id); + var document = new EpubDocument(bookTitle, bookAuthor, id); if (novelInfo.IsSerial) // 連載の時 { async IAsyncEnumerable<(string? title, Section section)> LoadDetailsAsync(IBrowsingContext context, NovelInfo novelInfo, string imageDirectory, [EnumeratorCancellation] CancellationToken ct) From 8a6b5d3cc46eb7a439193468a3fe0a6040eeaea9 Mon Sep 17 00:00:00 2001 From: aiueo-1234 <130837816+aiueo-1234@users.noreply.github.com> Date: Fri, 3 May 2024 11:08:04 +0900 Subject: [PATCH 5/6] =?UTF-8?q?#51=20=E3=82=B9=E3=83=88=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=83=A0=E5=91=A8=E3=82=8A=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Epub/KoeBook.Epub/Services/EpubGenerateService.cs | 4 +--- KoeBook.Core/Models/Audio.cs | 5 +++-- KoeBook.Core/Services/SoundGenerationService.cs | 4 +--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Epub/KoeBook.Epub/Services/EpubGenerateService.cs b/Epub/KoeBook.Epub/Services/EpubGenerateService.cs index 4c91af4..51423a7 100644 --- a/Epub/KoeBook.Epub/Services/EpubGenerateService.cs +++ b/Epub/KoeBook.Epub/Services/EpubGenerateService.cs @@ -23,9 +23,7 @@ public async ValueTask GenerateEpubAsync(BookScripts bookScripts, string { var scriptLine = bookScripts.ScriptLines[i]; var wavData = await _soundGenerationService.GenerateLineSoundAsync(scriptLine, bookScripts.Options, cancellationToken).ConfigureAwait(false); - var ms = new MemoryStream(); - ms.Write(wavData); - ms.Position = 0; + using var ms = new MemoryStream(wavData); using var reader = new WaveFileReader(ms); var tmpMp3Path = Path.Combine(tempDirectory, $"{document.Title}{i}.mp3"); MediaFoundationEncoder.EncodeToMp3(reader, tmpMp3Path); diff --git a/KoeBook.Core/Models/Audio.cs b/KoeBook.Core/Models/Audio.cs index d100060..6f519cd 100644 --- a/KoeBook.Core/Models/Audio.cs +++ b/KoeBook.Core/Models/Audio.cs @@ -1,4 +1,5 @@ -using NAudio.Wave; +using System.IO; +using NAudio.Wave; namespace KoeBook.Epub.Models; @@ -9,6 +10,6 @@ public sealed class Audio(TimeSpan totalTIme, string tempFilePath) public FileStream GetStream() { - return File.OpenRead(TempFilePath); + return new FileStream(TempFilePath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, true); } } diff --git a/KoeBook.Core/Services/SoundGenerationService.cs b/KoeBook.Core/Services/SoundGenerationService.cs index 991902a..338177c 100644 --- a/KoeBook.Core/Services/SoundGenerationService.cs +++ b/KoeBook.Core/Services/SoundGenerationService.cs @@ -33,9 +33,7 @@ public async ValueTask GenerateLineSoundAsync(ScriptLine scriptLine, Boo ArrayPool.Shared.Return(dataBuffer); dataBuffer = ArrayPool.Shared.Rent(voice.Length); } - using var msReader = new MemoryStream(); - await msReader.WriteAsync(voice, cancellationToken); - msReader.Position = 0; + using var msReader = new MemoryStream(voice); using var reader = new WaveFileReader(msReader); var read = await reader.ReadAsync(dataBuffer, cancellationToken); if (writer is null) From 5c96b1ea8eb4d26823843cb2cdf2c8cb56fcba3a Mon Sep 17 00:00:00 2001 From: aiueo-1234 <130837816+aiueo-1234@users.noreply.github.com> Date: Fri, 3 May 2024 11:13:52 +0900 Subject: [PATCH 6/6] =?UTF-8?q?#51=20=E3=83=86=E3=82=B9=E3=83=88=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KoeBook.Test/Epub/EpubDocumentTest.cs | 6 +++--- KoeBook.Test/Epub/ScrapingAozoraServiceTest.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/KoeBook.Test/Epub/EpubDocumentTest.cs b/KoeBook.Test/Epub/EpubDocumentTest.cs index c36a83b..e5868a8 100644 --- a/KoeBook.Test/Epub/EpubDocumentTest.cs +++ b/KoeBook.Test/Epub/EpubDocumentTest.cs @@ -8,7 +8,7 @@ public class EpubDocumentTest [Fact] public void EnsureChapter() { - var document = new EpubDocument("title", "author", "cover", default); + var document = new EpubDocument("title", "author", default); Assert.Empty(document.Chapters); @@ -29,7 +29,7 @@ public void EnsureChapter() [Fact] public void EnsureSection() { - var document = new EpubDocument("title", "author", "cover", default); + var document = new EpubDocument("title", "author", default); Assert.Empty(document.Chapters); @@ -77,7 +77,7 @@ public void EnsureSection() [Fact] public void EnsureParagraph() { - var document = new EpubDocument("title", "author", "cover", default); + var document = new EpubDocument("title", "author", default); Assert.Empty(document.Chapters); diff --git a/KoeBook.Test/Epub/ScrapingAozoraServiceTest.cs b/KoeBook.Test/Epub/ScrapingAozoraServiceTest.cs index 7a46dc5..6a1e7df 100644 --- a/KoeBook.Test/Epub/ScrapingAozoraServiceTest.cs +++ b/KoeBook.Test/Epub/ScrapingAozoraServiceTest.cs @@ -28,7 +28,7 @@ public async Task AddParagraphs1(string input, string[] expected) using var context = BrowsingContext.New(Configuration.Default); using var doc = await context.OpenAsync(req => req.Content(input)); Assert.NotNull(doc.ParentElement); - var epubDocument = new EpubDocument("title", "author", "", default) + var epubDocument = new EpubDocument("title", "author", default) { Chapters = [new() { Sections = [new("section title") { Elements = [new Paragraph() { Text = "test" }] }] }] };