Skip to content

Commit

Permalink
feat: 新增语音
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyueyi committed Jul 26, 2024
1 parent 02d669a commit 1c00fb3
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.github.hui.quick.plugin.tts.service;

import com.github.hui.quick.plugin.tts.constant.LocaleEnum;
import com.github.hui.quick.plugin.tts.constant.VoiceEnum;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* 语音相关服务
*
* @author YiHui
* @date 2024/7/26
*/
public class LocaleService {

/**
* 根据大语言类型,获取对应的语言枚举
*
* @return
*/
public Map<String, List<LocaleEnum>> getLocals() {
return Arrays.stream(LocaleEnum.values()).collect(Collectors.groupingBy(LocaleEnum::getLocale));
}


/**
* 获取某个语言对应的语音列表
*
* @param local
* @return
*/
public List<VoiceEnum> getVoiceByLocale(LocaleEnum local) {
return Arrays.stream(VoiceEnum.values()).filter(s -> s.getLocale().equals(local.getLocale())).collect(Collectors.toList());
}
}

0 comments on commit 1c00fb3

Please sign in to comment.