ow
This commit is contained in:
commit
597b88d075
37 files changed
+3943
No files matched your search
@@ -0,0 +1,42 @@
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
using CloudBuilder.Core.DependencyInjection.Task;
|
||||
using CloudBuilder.Topshelf.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace CloudBuilder.Topshelf.Task.TTS
|
||||
{
|
||||
//task:TtsTask voice:Sherpa2 save_path:D:\MAFAI\cc.wav text:乌云忽然凝聚变形,瞬间化为了一个身高寸许的黑绿婴儿出来,并口吐人言的说道。
|
||||
public class TtsTask : IScheduleTask
|
||||
{
|
||||
private readonly IApplicationService service;
|
||||
|
||||
public TtsTask(IApplicationService service)
|
||||
{
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public void Run(Dictionary<string, string> bodyDict)
|
||||
{
|
||||
string save_path = string.Empty, text = string.Empty, voice = ChineseTtsVoice.Sherpa2.ToString();
|
||||
if (bodyDict.ContainsKey("voice"))
|
||||
voice = bodyDict["voice"];
|
||||
|
||||
if (bodyDict.ContainsKey("save_path"))
|
||||
save_path = bodyDict["save_path"];
|
||||
|
||||
if (bodyDict.ContainsKey("text"))
|
||||
text = bodyDict["text"];
|
||||
|
||||
if (string.IsNullOrEmpty(voice) || string.IsNullOrEmpty(save_path) || string.IsNullOrEmpty(text)) return;
|
||||
|
||||
SaveAudioToFileHelper.AudioToFile(EnumHelper.ToEnum<ChineseTtsVoice>(voice), text, save_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user