Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): Bump jna.version from 5.9.0 to 5.14.0 #982

Merged
merged 5 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions core/src/main/java/com/tlcsdm/core/util/VoskUtil.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,12 +48,13 @@
import java.util.List;

/**
* vosk工具类.
*
* @author unknowIfGuestInDream
* vosk 工具类.
*/
public class VoskUtil {

private VoskUtil() {
}

/**
* 获取wav音频文件文本.
*/
Expand All @@ -35,10 +63,10 @@ public static List<String> decoder(String wavPath, String modalPath) {
throw new CoreException("Only WAV audio files are supported.");
}
List<String> 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];
Expand Down
12 changes: 9 additions & 3 deletions jenkins/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<yuicompressor.version>2.4.8</yuicompressor.version>
<jface.version>3.32.0</jface.version>
<swt.version>3.124.200</swt.version>
<jna.version>5.9.0</jna.version>
<jna.version>5.14.0</jna.version>
<vosk.version>0.3.45</vosk.version>
<java2.version>3.4.0</java2.version>
<jakarta.xml.bind-api.version>4.0.1</jakarta.xml.bind-api.version>
Expand Down