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
e374a09e
Commit
e374a09e
authored
9 months ago
by
周亚武
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改合并mp3文件规则
parent
415761c3
master
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
src/main/java/com/mortals/xhx/tts/UI/MainWindow.java
src/main/java/com/mortals/xhx/tts/UI/MainWindow.java
+4
-4
src/main/java/com/mortals/xhx/tts/utils/AddMp3Util.java
src/main/java/com/mortals/xhx/tts/utils/AddMp3Util.java
+12
-11
No files found.
src/main/java/com/mortals/xhx/tts/UI/MainWindow.java
View file @
e374a09e
...
...
@@ -698,8 +698,8 @@ public class MainWindow {
}
audioList
.
add
(
people
+
"kk.mp3"
);
String
url
=
SpliceMp3Util
.
heBingMp3
(
audioList
);
//
String url = AddMp3Util.mergeMp3s(audioList);
//
String url = SpliceMp3Util.heBingMp3(audioList);
String
url
=
AddMp3Util
.
mergeMp3s
(
audioList
);
if
(
url
!=
null
){
if
(
speaker
.
equals
(
"en"
)){
...
...
@@ -849,8 +849,8 @@ public class MainWindow {
}
audioList
.
add
(
people
+
"kk.mp3"
);
String
url
=
SpliceMp3Util
.
heBingMp3
(
audioList
);
//
String url = AddMp3Util.mergeMp3s(audioList);
//
String url = SpliceMp3Util.heBingMp3(audioList);
String
url
=
AddMp3Util
.
mergeMp3s
(
audioList
);
if
(
url
!=
null
){
if
(
english
){
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/mortals/xhx/tts/utils/AddMp3Util.java
View file @
e374a09e
...
...
@@ -18,7 +18,7 @@ import java.util.List;
public
class
AddMp3Util
{
public
static
String
mergeMp3s
(
List
<
String
>
inputPaths
)
throws
IOException
,
InvalidDataException
,
UnsupportedTagException
{
public
static
String
mergeMp3s
(
List
<
String
>
inputPaths
)
throws
IOException
{
String
outputPath
=
"/tmp/"
;
if
(
System
.
getProperty
(
"os.name"
).
startsWith
(
"Windows"
)){
//windows电脑测试路径
outputPath
=
"F:\\\\"
;
...
...
@@ -28,21 +28,22 @@ public class AddMp3Util {
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
);
String
fileName
=
inputPath
.
substring
(
inputPath
.
lastIndexOf
(
"/"
)+
1
);
File
nowFile
=
new
File
(
outputPath
+
fileName
);
//转换
FileUtils
.
copyInputStreamToFile
(
inputStream
,
nowFile
);
Mp3File
mp3
=
new
Mp3File
(
nowFile
);
byte
[]
buffer
=
mp3
.
getCustomTag
();
fos
.
write
(
buffer
);
mp3
.
removeCustomTag
();
fos
.
close
();
while
((
length
=
inputStream
.
read
(
buffer
))
>
0
)
{
fos
.
write
(
buffer
,
0
,
length
);
}
inputStream
.
close
();
}
fos
.
close
();
return
outputPath
;
}
...
...
This diff is collapsed.
Click to expand it.
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