summaryrefslogtreecommitdiff
path: root/mkvlib
diff options
context:
space:
mode:
authorb5f0d6c3 <[email protected]>2021-10-20 09:38:30 +0800
committerb5f0d6c3 <[email protected]>2021-10-20 09:38:30 +0800
commit42fc714c6e8fbaee487c133634542708ef5649c9 (patch)
treec8a079ce2c3721f5d65972fedc8c6f8fe826ec36 /mkvlib
parentfe742b78e7ac4528c49203b490ea83e86300a38d (diff)
update mkvlib:fix dump bug
Diffstat (limited to 'mkvlib')
-rw-r--r--mkvlib/mkv.go54
-rw-r--r--mkvlib/shared.go2
2 files changed, 33 insertions, 23 deletions
diff --git a/mkvlib/mkv.go b/mkvlib/mkv.go
index 69ebd74..268cd49 100644
--- a/mkvlib/mkv.go
+++ b/mkvlib/mkv.go
@@ -71,36 +71,46 @@ func (self *mkvProcessor) DumpMKV(file, output string, subset bool) bool {
tracks = append(tracks, fmt.Sprintf(`%d:%s`, _item.ID, path.Join(output, s)))
}
}
- args := make([]string, 0)
- args = append(args, file)
- args = append(args, "attachments")
- args = append(args, attachments...)
- args = append(args, "tracks")
- args = append(args, tracks...)
- if p, err := newProcess(nil, nil, nil, "", mkvextract, args...); err == nil {
- s, err := p.Wait()
- ok := err == nil && s.ExitCode() == 0
- if ok {
- if subset {
- asses := make([]string, 0)
- for _, _item := range tracks {
- _arr := strings.Split(_item, ":")
- f := _arr[len(_arr)-1]
- if strings.HasSuffix(f, ".ass") {
- asses = append(asses, f)
- }
- if len(asses) > 0 {
- if !self.ASSFontSubset(asses, "", "", false) {
- ec++
+ la := len(attachments)
+ lt := len(tracks)
+ if la > 0 || lt > 0 {
+ args := make([]string, 0)
+ args = append(args, file)
+ if la > 0 {
+ args = append(args, "attachments")
+ args = append(args, attachments...)
+ }
+ if lt > 0 {
+ args = append(args, "tracks")
+ args = append(args, tracks...)
+ }
+ if p, err := newProcess(nil, nil, nil, "", mkvextract, args...); err == nil {
+ s, err := p.Wait()
+ ok := err == nil && s.ExitCode() == 0
+ if ok {
+ if subset {
+ asses := make([]string, 0)
+ for _, _item := range tracks {
+ _arr := strings.Split(_item, ":")
+ f := _arr[len(_arr)-1]
+ if strings.HasSuffix(f, ".ass") {
+ asses = append(asses, f)
+ }
+ if len(asses) > 0 {
+ if !self.ASSFontSubset(asses, "", "", false) {
+ ec++
+ }
}
}
}
+ } else {
+ ec++
}
} else {
ec++
}
} else {
- ec++
+ log.Printf(`This mkv file is not has the subtitles & attachments: "%s"`, file)
}
return ec == 0
}
diff --git a/mkvlib/shared.go b/mkvlib/shared.go
index 0ea9f04..5deaf68 100644
--- a/mkvlib/shared.go
+++ b/mkvlib/shared.go
@@ -10,7 +10,7 @@ import (
)
const libName = "mkvlib"
-const libVer = "v1.0.3"
+const libVer = "v1.0.4"
const LibFName = libName + " " + libVer