From 7eb017d8ee06164ec0d115c3154c98b6d70051f8 Mon Sep 17 00:00:00 2001 From: owenchen Date: Wed, 24 Jun 2026 08:30:57 +0800 Subject: [PATCH] ow --- CloudBuilder.AI.Service/AiBookService.auto.cs | 36 ++++++++++++++++--- .../FolderProfile1.pubxml.user | 2 +- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CloudBuilder.AI.Service/AiBookService.auto.cs b/CloudBuilder.AI.Service/AiBookService.auto.cs index 00bfb40..a5706ab 100644 --- a/CloudBuilder.AI.Service/AiBookService.auto.cs +++ b/CloudBuilder.AI.Service/AiBookService.auto.cs @@ -283,17 +283,29 @@ namespace CloudBuilder.AI.Service return new FileStreamResult(stream, contentType) { FileDownloadName = fileDownloadName }; } + //[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)] + //public void GenerateMp3(AiChapterEntity[] chapters) + //{ + // string save_path = Path.Combine(service.Configuration["FileServiceSettings:BackupDmsFileDirectory"], @"voice"); + // foreach (AiChapterEntity sentence in chapters) + // { + // string param = PackTtsParameters(save_path, sentence.BookId, sentence.ChapterId.ToString()); + // RunMyProcessAsync(service.Configuration["CloudBuilder.Topshelf:Path"], param); + // } + //} + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)] public void GenerateMp3(AiChapterEntity[] chapters) { string save_path = Path.Combine(service.Configuration["FileServiceSettings:BackupDmsFileDirectory"], @"voice"); foreach (AiChapterEntity sentence in chapters) { - string param = PackTtsParameters(save_path, sentence.BookId, sentence.ChapterId.ToString()); - RunMyProcessAsync(service.Configuration["CloudBuilder.Topshelf:Path"], param); + string param = PackTtsParameters(ChineseTtsVoice.Sherpa2.ToString(), save_path, sentence.BookId, sentence.ChapterId.ToString()); + RunMyProcess(service.Configuration["CloudBuilder.Topshelf:Path"], param); } } + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)] public void GenerateMp3ByBookId(string bookId) { @@ -304,8 +316,8 @@ namespace CloudBuilder.AI.Service string save_path = Path.Combine(service.Configuration["FileServiceSettings:BackupDmsFileDirectory"], @"voice"); foreach (AiChapterEntity sentence in chapters) { - string param = PackTtsParameters(save_path, sentence.BookId, sentence.ChapterId.ToString()); - RunMyProcessAsync(service.Configuration["CloudBuilder.Topshelf:Path"], param); + string param = PackTtsParameters(ChineseTtsVoice.Sherpa2.ToString(), save_path, sentence.BookId, sentence.ChapterId.ToString()); + RunMyProcess(service.Configuration["CloudBuilder.Topshelf:Path"], param); } } @@ -346,7 +358,21 @@ namespace CloudBuilder.AI.Service return para.ToArray().ToDelimiteredList(' '); } - private string PackTtsParameters(string save_path, string bookId, string chapterId) + private string PackTtsParameters(string voice, string save_path, string bookId, string chapterId) + { + //task:TtsTask book_id:B000008 chapter_id:3 speed:1 voice:Sherpa2 actor:韩立 actor_voice:Sherpa1 save_path:D:\\Net8\\FileServer\\Backup\\DmsFile\\voice + List para = new List(); + para.Add("task:" + "TtsTask"); + para.Add("book_id:" + bookId); + para.Add("chapter_id:" + chapterId); + para.Add("voice:" + voice); + para.Add("save_path:" + save_path); + para.Add("speed:1"); + para.Add("actor:NA"); + return para.ToArray().ToDelimiteredList(' '); + } + + private string PackSoVITSTtsTaskParameters(string save_path, string bookId, string chapterId) { //速度快,音质差 //task:TtsTask book_id:B000008 chapter_id:3 speed:1 voice:Sherpa2 actor:韩立 actor_voice:Sherpa1 save_path:D:\\Net8\\FileServer\\Backup\\DmsFile\\voice diff --git a/CloudBuilder.Web.Entry/Properties/PublishProfiles/FolderProfile1.pubxml.user b/CloudBuilder.Web.Entry/Properties/PublishProfiles/FolderProfile1.pubxml.user index 2183105..19e2189 100644 --- a/CloudBuilder.Web.Entry/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/CloudBuilder.Web.Entry/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -3,7 +3,7 @@ <_PublishTargetUrl>C:\inetpub\wwwroot\webapi - True|2026-06-23T02:11:00.8522806Z||; + True|2026-06-24T00:26:55.0324041Z||;True|2026-06-24T08:21:40.3334931+08:00||;True|2026-06-24T08:20:33.0781131+08:00||;True|2026-06-24T08:09:48.1948679+08:00||;True|2026-06-23T10:11:00.8522806+08:00||; \ No newline at end of file