Commit f2a7c0bf authored by 周亚武's avatar 周亚武

语音合成规则修改

parent 8d5e9bb1
......@@ -286,13 +286,13 @@ public class MainWindow {
pushInitMsg("访问register接口");
DeviceCodeBean cb = new DeviceCodeBean(deviceId, "1");
String result = HttpRequest.post(httpIndex+host+register).body(gson.toJson(cb)).execute().body();
log.info(result);
ResultBean rb = gson.fromJson(result,ResultBean.class);
if(rb.getCode() == 1){
pushInitMsg("register访问成功");
try {
ContentBean contentBean = gson.fromJson(gson.toJson(rb.getData()), ContentBean.class);
String data = EncryptUtil.myReEnscrt(contentBean.getContent(),Constant.ORDERNUM,Constant.DESKEY,Constant.AESKEY);
log.info(data);
ResultRabbitBean rmb = gson.fromJson(data, ResultRabbitBean.class);
RabbitMessBean rabbitMessBean = rmb.getRabbmitInfo();
rabbitHost = rabbitMessBean.getHost();
......@@ -315,6 +315,7 @@ public class MainWindow {
pushInitMsg("register返回数据解密失败:"+result);
}
}else {
log.info(result);
pushInitMsg("register返回异常:"+rb.getMsg());
}
......
......@@ -20,17 +20,15 @@ public class SpliceMp3Util {
* 返回分离出MP3文件中的数据帧的文件路径
*
*/
public static String fenLiData(String path) throws IOException {
public static String fenLiData(String path,String lujing) throws IOException {
ClassLoader classLoader = MainWindow.class.getClassLoader();
InputStream inputStream = classLoader.getResourceAsStream(path);
File tempFile = File.createTempFile("tmp", "mp3");
tempFile.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(tempFile)) {
IOUtils.copy(inputStream, out);
}
File file1 = new File(path + "01");// 分离ID3V2后的文件,这是个中间文件,最后要被删除
File file2 = new File(path + "001");// 分离id3v1后的文件
RandomAccessFile rf = new RandomAccessFile(tempFile, "rw");// 随机读取文件
File file = new File(lujing+"tmp.mp3");
//转换
FileUtils.copyInputStreamToFile(inputStream, file);
File file1 = new File(file.getAbsolutePath() + "01");// 分离ID3V2后的文件,这是个中间文件,最后要被删除
File file2 = new File(file.getAbsolutePath() + "001");// 分离id3v1后的文件
RandomAccessFile rf = new RandomAccessFile(file, "rw");// 随即读取文件
FileOutputStream fos = new FileOutputStream(file1);
byte ID3[] = new byte[3];
rf.read(ID3);
......@@ -91,6 +89,11 @@ public class SpliceMp3Util {
{
file1.delete();
}
if (file.exists())// 删除中间文件
{
file.delete();
}
return file2.getAbsolutePath();
}
......@@ -220,7 +223,7 @@ public class SpliceMp3Util {
File file2=new File(luJing+"new.mp3");
FileOutputStream out;
for (int i = 0; i < pathList.size(); i++) {
String fenLiData = fenLiData(pathList.get(i));
String fenLiData = fenLiData(pathList.get(i),luJing);
File file=new File(fenLiData);
FileInputStream in=new FileInputStream(file);
if(i == 0){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment