summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorb5f0d6c3 <[email protected]>2022-04-27 20:04:30 +0800
committerb5f0d6c3 <[email protected]>2022-04-27 20:04:30 +0800
commitd4b6dc5dc0b27c5b515aaeaa485091b55c94e216 (patch)
tree830a1420d2e416d0789c0bc1d80873f4ec8065c5
parentd6d9f9c62975a434522a27222c6e099f923db01d (diff)
update mkvlib:fix bugs
-rw-r--r--mkvlib/ass.go14
-rw-r--r--mkvlib/shared.go2
2 files changed, 11 insertions, 5 deletions
diff --git a/mkvlib/ass.go b/mkvlib/ass.go
index 1527bbf..a0c0677 100644
--- a/mkvlib/ass.go
+++ b/mkvlib/ass.go
@@ -423,10 +423,10 @@ func (self *assProcessor) matchFonts() bool {
func (self *assProcessor) createFontSubset(font *fontInfo) bool {
ok := false
- fn := fmt.Sprintf(`%s^%s.txt`, font.file, font.rand)
+ fn := fmt.Sprintf(`%s.%s.txt`, font.newName, font.rand)
_, fn, _, _ = splitPath(fn)
fn = path.Join(self.tDir, fn)
- _, n, e, ne := splitPath(font.file)
+ _, n, e, _ := splitPath(font.file)
if strings.ToLower(e) == ".ttc" {
e = ".ttf"
}
@@ -436,7 +436,7 @@ func (self *assProcessor) createFontSubset(font *fontInfo) bool {
return false
}
if os.WriteFile(fn, []byte(font.str), os.ModePerm) == nil {
- _fn := fmt.Sprintf("%s^%s.%s%s", ne, font.rand, font.newName, e)
+ _fn := fmt.Sprintf("%s.%s%s", font.newName, font.rand, e)
_fn = path.Join(self.output, _fn)
args := make([]string, 0)
args = append(args, "--text-file="+fn)
@@ -613,7 +613,13 @@ func (self *assProcessor) replaceFontNameInAss() bool {
comments = append(comments, "; Processed by "+LibFName+" at "+time.Now().Format("2006-01-02 15:04:05"))
comments = append(comments, "; ----- Font subset end -----")
comments = append(comments, "")
- s = strings.Replace(s, "[Script Info]\r\n", strings.Join(comments, "\r\n"), 1)
+ r := "[Script Info]\n"
+ _r := "\n"
+ if strings.Contains(s, "[Script Info]\r\n") {
+ r = "[Script Info]\r\n"
+ _r = "\r\n"
+ }
+ s = strings.Replace(s, r, strings.Join(comments, _r), 1)
_, n, _, _ := splitPath(f)
fn := path.Join(self.output, n)
ok := false
diff --git a/mkvlib/shared.go b/mkvlib/shared.go
index f71f9a8..857ba3c 100644
--- a/mkvlib/shared.go
+++ b/mkvlib/shared.go
@@ -11,7 +11,7 @@ import (
)
const libName = "mkvlib"
-const libVer = "v1.5.2"
+const libVer = "v1.5.3"
const LibFName = libName + " " + libVer