forked from wxbool/video-srt-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.支持同时输出多格式文件(srt、lrc、txt) 2.支持批量对SRT字幕文件进行二次翻译、编码处理 3.支持自动清理上传至OSS的临时文件(默认开启,可关闭) 4.支持设置双语字幕的主字幕(输入/输出) 5.优化错误提示
- Loading branch information
Showing
14 changed files
with
1,233 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package app | ||
|
||
import ( | ||
"bytes" | ||
"strconv" | ||
"videosrt/app/tool" | ||
) | ||
|
||
//拼接字幕字符串 | ||
func MakeSubtitleText(index int , startTime int64 , endTime int64 , text string , translateText string , bilingualSubtitleSwitch bool , bilingualAsc bool) string { | ||
var content bytes.Buffer | ||
content.WriteString(strconv.Itoa(index)) | ||
content.WriteString("\r\n") | ||
content.WriteString(tool.SubtitleTimeMillisecond(startTime , true)) | ||
content.WriteString(" --> ") | ||
content.WriteString(tool.SubtitleTimeMillisecond(endTime , true)) | ||
content.WriteString("\r\n") | ||
|
||
//输出双语字幕 | ||
if bilingualSubtitleSwitch { | ||
if bilingualAsc { | ||
content.WriteString(text) | ||
content.WriteString("\r\n") | ||
content.WriteString(translateText) | ||
} else { | ||
content.WriteString(translateText) | ||
content.WriteString("\r\n") | ||
content.WriteString(text) | ||
} | ||
} else { | ||
content.WriteString(text) | ||
} | ||
|
||
content.WriteString("\r\n") | ||
content.WriteString("\r\n") | ||
return content.String() | ||
} | ||
|
||
|
||
//拼接文本格式 | ||
func MakeText(index int , startTime int64 , endTime int64 , text string) string { | ||
var content bytes.Buffer | ||
content.WriteString(text) | ||
content.WriteString("\r\n") | ||
content.WriteString("\r\n") | ||
return content.String() | ||
} | ||
|
||
|
||
//拼接歌词文本 | ||
func MakeMusicLrcText(index int , startTime int64 , endTime int64 , text string) string { | ||
var content bytes.Buffer | ||
content.WriteString("[") | ||
content.WriteString(tool.MusicLrcTextMillisecond(startTime)) | ||
content.WriteString("]") | ||
content.WriteString(text) | ||
content.WriteString("\r\n") | ||
return content.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.