diff --git a/core/src/main/java/com/tlcsdm/core/util/VoskUtil.java b/core/src/main/java/com/tlcsdm/core/util/VoskUtil.java index 4ac541365..0dff1f30d 100644 --- a/core/src/main/java/com/tlcsdm/core/util/VoskUtil.java +++ b/core/src/main/java/com/tlcsdm/core/util/VoskUtil.java @@ -1,3 +1,30 @@ +/* + * Copyright (c) 2023 unknowIfGuestInDream. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of unknowIfGuestInDream, any associated website, nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL UNKNOWIFGUESTINDREAM BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package com.tlcsdm.core.util; import cn.hutool.core.io.FileUtil; @@ -21,12 +48,13 @@ import java.util.List; /** - * vosk工具类. - * - * @author unknowIfGuestInDream + * vosk 工具类. */ public class VoskUtil { + private VoskUtil() { + } + /** * 获取wav音频文件文本. */ @@ -35,10 +63,10 @@ public static List decoder(String wavPath, String modalPath) { throw new CoreException("Only WAV audio files are supported."); } List list = new ArrayList<>(); + System.setProperty("jna.encoding", CoreConstant.ENCODING_UTF_8); LibVosk.setLogLevel(LogLevel.INFO); try (Model model = new Model(modalPath); - InputStream ais = AudioSystem.getAudioInputStream(new BufferedInputStream - (new FileInputStream(wavPath))); + InputStream ais = AudioSystem.getAudioInputStream(new BufferedInputStream(new FileInputStream(wavPath))); Recognizer recognizer = new Recognizer(model, 16000)) { int nbytes; byte[] b = new byte[4096]; diff --git a/jenkins/package.sh b/jenkins/package.sh index 04e9ebe64..6125c4b16 100644 --- a/jenkins/package.sh +++ b/jenkins/package.sh @@ -41,11 +41,13 @@ $M2_HOME/bin/mvn -f ${mod}/pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platfo cp ${mod}/target/javafxTool-${mod}.jar javafxTool-${mod}.jar cp -r ${mod}/target/lib lib cp -r ${mod}/target/apidocs apidocs -zip -r ${mod}Tool-win_b${BUILD_NUMBER}_$(date +%Y%m%d).zip docs javafxTool-${mod}.jar lib apidocs LICENSE +cp -r ${mod}/target/license license +zip -r ${mod}Tool-win_b${BUILD_NUMBER}_$(date +%Y%m%d).zip docs javafxTool-${mod}.jar lib apidocs license zip -uj ${mod}Tool-win_b${BUILD_NUMBER}_$(date +%Y%m%d).zip jenkins/window/${mod}/* rm javafxTool-${mod}.jar rm -r lib rm -r apidocs +rm -r license done $M2_HOME/bin/mvn -f pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platform=mac -Dmaven.test.skip=true clean install @@ -56,11 +58,13 @@ $M2_HOME/bin/mvn -f ${mod}/pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platfo cp ${mod}/target/javafxTool-${mod}.jar javafxTool-${mod}.jar cp -r ${mod}/target/lib lib cp -r ${mod}/target/apidocs apidocs -zip -r ${mod}Tool-mac_b${BUILD_NUMBER}_$(date +%Y%m%d).zip docs javafxTool-${mod}.jar lib apidocs LICENSE +cp -r ${mod}/target/license license +zip -r ${mod}Tool-mac_b${BUILD_NUMBER}_$(date +%Y%m%d).zip docs javafxTool-${mod}.jar lib apidocs license zip -uj ${mod}Tool-mac_b${BUILD_NUMBER}_$(date +%Y%m%d).zip jenkins/mac/${mod}/* rm javafxTool-${mod}.jar rm -r lib rm -r apidocs +rm -r license done $M2_HOME/bin/mvn -f pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platform=linux -Dmaven.test.skip=true clean install @@ -71,9 +75,11 @@ $M2_HOME/bin/mvn -f ${mod}/pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platfo cp ${mod}/target/javafxTool-${mod}.jar javafxTool-${mod}.jar cp -r ${mod}/target/lib lib cp -r ${mod}/target/apidocs apidocs -zip -r ${mod}Tool-linux_b${BUILD_NUMBER}_$(date +%Y%m%d).zip docs javafxTool-${mod}.jar lib apidocs LICENSE +cp -r ${mod}/target/license license +zip -r ${mod}Tool-linux_b${BUILD_NUMBER}_$(date +%Y%m%d).zip docs javafxTool-${mod}.jar lib apidocs license zip -uj ${mod}Tool-linux_b${BUILD_NUMBER}_$(date +%Y%m%d).zip jenkins/linux/${mod}/* rm javafxTool-${mod}.jar rm -r lib rm -r apidocs +rm -r license done diff --git a/pom.xml b/pom.xml index b3e1193c6..cab0b33c3 100644 --- a/pom.xml +++ b/pom.xml @@ -122,7 +122,7 @@ 2.4.8 3.32.0 3.124.200 - 5.9.0 + 5.14.0 0.3.45 3.4.0 4.0.1