diff options
| author | b5f0d6c3 <[email protected]> | 2022-05-06 01:24:12 +0800 |
|---|---|---|
| committer | b5f0d6c3 <[email protected]> | 2022-05-06 01:24:12 +0800 |
| commit | 8c382de8c87260d68b9c10e2bf687cbd53e3beb8 (patch) | |
| tree | 51d7b3fcb01fd99347e12e3262d42da7b37182ef /mkvtool/main.go | |
| parent | 76722d11d3d99c8ea93f6c906e22f697e568b7da (diff) | |
update
Diffstat (limited to 'mkvtool/main.go')
| -rw-r--r-- | mkvtool/main.go | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/mkvtool/main.go b/mkvtool/main.go index eb13eec..5ce6de8 100644 --- a/mkvtool/main.go +++ b/mkvtool/main.go @@ -1,7 +1,6 @@ package main import ( - "errors" "flag" "fmt" "github.com/KurenaiRyu/MkvAutoSubset/mkvlib" @@ -12,7 +11,6 @@ import ( "net/http" "os" "path" - "path/filepath" "regexp" "runtime" "strings" @@ -66,6 +64,7 @@ func main() { mks := false ck := false cks := false + t := false sl, st := "", "" af, ao := "", "" flog := "" @@ -191,6 +190,17 @@ func main() { if len(*asses) > 0 { if !processer.ASSFontSubset(*asses, af, ao, !ans, nil) { ec++ + } else if t { + d, _, _, _ := splitPath((*asses)[0]) + if ao == "" { + ao = path.Join(d, "subsetted") + } + _asses, _ := findPath(ao, `\.ass$`) + if len(_asses) > 0 { + p := fmt.Sprintf("test-%s.a", randomStr(8)) + p = path.Join(d, p) + processer.CreateTestVideo(_asses, ao, "nvenc_h264", p, nil) + } } return } @@ -272,34 +282,3 @@ func getLatestTag() { } } } - -func findPath(path, expr string) (list []string, err error) { - list = make([]string, 0) - reg, e := regexp.Compile(expr) - if e != nil { - err = e - return - } - err = queryPath(path, func(path string) bool { - if expr == "" || reg.MatchString(path) { - list = append(list, path) - } - return true - }) - return -} - -func queryPath(path string, cb func(string) bool) error { - return filepath.Walk(path, func(path string, f os.FileInfo, err error) error { - if f == nil { - return err - } - if f.IsDir() { - return nil - } - if cb(path) { - return nil - } - return errors.New("call cb return false") - }) -} |
