Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tts-client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周亚武
tts-client
Commits
28a50d86
Commit
28a50d86
authored
Aug 26, 2024
by
周亚武
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改合并mp3文件规则
parent
90d6464f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
117 deletions
+33
-117
pom.xml
pom.xml
+20
-20
src/main/java/com/mortals/xhx/tts/UI/MainWindow.java
src/main/java/com/mortals/xhx/tts/UI/MainWindow.java
+13
-13
src/main/java/com/mortals/xhx/tts/utils/AddMp3Util.java
src/main/java/com/mortals/xhx/tts/utils/AddMp3Util.java
+0
-50
src/main/java/com/mortals/xhx/tts/utils/ResourceExporter.java
...main/java/com/mortals/xhx/tts/utils/ResourceExporter.java
+0
-34
No files found.
pom.xml
View file @
28a50d86
...
@@ -308,26 +308,26 @@
...
@@ -308,26 +308,26 @@
</configuration>
</configuration>
</execution>
</execution>
<execution
>
<!-- <execution>--
>
<id>
copy-sound
</id
>
<!-- <id>copy-sound</id>--
>
<phase>
package
</phase
>
<!-- <phase>package</phase>--
>
<goals
>
<!-- <goals>--
>
<goal>
copy-resources
</goal
>
<!-- <goal>copy-resources</goal>--
>
</goals
>
<!-- </goals>--
>
<configuration
>
<!-- <configuration>--
>
<encoding>
UTF-8
</encoding
>
<!-- <encoding>UTF-8</encoding>--
>
<outputDirectory>
dist/${project.artifactId}/sound
</outputDirectory
>
<!-- <outputDirectory>dist/${project.artifactId}/sound</outputDirectory>--
>
<resources
>
<!-- <resources>--
>
<resource
>
<!-- <resource>--
>
<directory>
src/main/resources/
</directory
>
<!-- <directory>src/main/resources/</directory>--
>
<includes
>
<!-- <includes>--
>
<include>
sound/**
</include
>
<!-- <include>sound/**</include>--
>
</includes
>
<!-- </includes>--
>
<filtering>
true
</filtering
>
<!-- <filtering>true</filtering>--
>
</resource
>
<!-- </resource>--
>
</resources
>
<!-- </resources>--
>
</configuration
>
<!-- </configuration>--
>
</execution
>
<!-- </execution>--
>
<execution>
<execution>
...
...
src/main/java/com/mortals/xhx/tts/UI/MainWindow.java
View file @
28a50d86
...
@@ -322,19 +322,19 @@ public class MainWindow {
...
@@ -322,19 +322,19 @@ public class MainWindow {
while
(
true
){
//
while (true){
try
{
//
try {
Thread
.
sleep
(
2000
);
//
Thread.sleep(2000);
}
catch
(
InterruptedException
e
)
{
//
} catch (InterruptedException e) {
throw
new
RuntimeException
(
e
);
//
throw new RuntimeException(e);
}
//
}
//
FlowNumBean
flowNumBean
=
new
FlowNumBean
(
6
,
"A00"
+(
msgIndex
%
100
),
"010"
,
"010"
,
System
.
currentTimeMillis
());
//
FlowNumBean flowNumBean = new FlowNumBean(6, "A00"+(msgIndex%100), "010", "010", System.currentTimeMillis());
pushRabbitMsg
(
"请"
+
flowNumBean
.
getFlownum
()+
"号到"
+
flowNumBean
.
getWindowfromnum
()+
"号窗口"
);
//
pushRabbitMsg("请"+flowNumBean.getFlownum()+"号到"+flowNumBean.getWindowfromnum()+"号窗口");
test
(
flowNumBean
);
//
test(flowNumBean);
//
//
}
//
}
}
}
private
void
initMQ
(){
private
void
initMQ
(){
...
...
src/main/java/com/mortals/xhx/tts/utils/AddMp3Util.java
deleted
100644 → 0
View file @
90d6464f
package
com.mortals.xhx.tts.utils
;
import
com.mpatric.mp3agic.InvalidDataException
;
import
com.mpatric.mp3agic.Mp3File
;
import
com.mpatric.mp3agic.MpegFrame
;
import
com.mpatric.mp3agic.UnsupportedTagException
;
import
org.apache.commons.io.FileUtils
;
import
javax.sound.sampled.*
;
import
java.io.*
;
import
java.nio.ByteBuffer
;
import
java.util.List
;
/**
* @author ZYW
* @date 2024-08-23 9:19
*/
public
class
AddMp3Util
{
public
static
String
mergeMp3s
(
List
<
String
>
inputPaths
)
throws
IOException
{
String
outputPath
=
"/tmp/"
;
if
(
System
.
getProperty
(
"os.name"
).
startsWith
(
"Windows"
)){
//windows电脑测试路径
outputPath
=
"F:\\\\"
;
}
File
file
=
new
File
(
outputPath
+
"new.mp3"
);
if
(
file
.
exists
())
{
file
.
delete
();
}
FileOutputStream
fos
=
new
FileOutputStream
(
outputPath
+
"new.mp3"
);
byte
[]
buffer
=
new
byte
[
4096
];
int
length
;
for
(
String
inputPath
:
inputPaths
)
{
ClassLoader
classLoader
=
AddMp3Util
.
class
.
getClassLoader
();
InputStream
inputStream
=
classLoader
.
getResourceAsStream
(
inputPath
);
while
((
length
=
inputStream
.
read
(
buffer
))
>
0
)
{
fos
.
write
(
buffer
,
0
,
length
);
}
inputStream
.
close
();
}
fos
.
close
();
return
outputPath
+
"new.mp3"
;
}
}
src/main/java/com/mortals/xhx/tts/utils/ResourceExporter.java
deleted
100644 → 0
View file @
90d6464f
package
com.mortals.xhx.tts.utils
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.StandardCopyOption
;
/**
* @author ZYW
* @date 2024-08-26 10:50
*/
public
class
ResourceExporter
{
public
static
void
exportResource
(
String
resourcePath
,
String
outputPath
)
throws
IOException
{
// 获取资源作为输入流
try
(
InputStream
inputStream
=
ResourceExporter
.
class
.
getClassLoader
().
getResourceAsStream
(
resourcePath
))
{
// 判断资源是否存在
if
(
inputStream
==
null
)
{
throw
new
FileNotFoundException
(
"Resource "
+
resourcePath
+
" not found"
);
}
// 输出路径转换为Path对象
Path
outputDir
=
Paths
.
get
(
outputPath
);
// 确保输出目录存在
Files
.
createDirectories
(
outputDir
);
// 输出文件的完整路径
Path
outputFile
=
outputDir
.
resolve
(
resourcePath
);
// 将资源复制到输出文件
Files
.
copy
(
inputStream
,
outputFile
,
StandardCopyOption
.
REPLACE_EXISTING
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment