From e2be87320e2d49e70a212cd080e91bf0981ac131 Mon Sep 17 00:00:00 2001 From: ac79b0c6 <105047743+ac79b0c6@users.noreply.github.com> Date: Mon, 6 Jun 2022 09:30:46 +0800 Subject: update mkvlib:add log level --- mkvlib/mkv.go | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'mkvlib/mkv.go') diff --git a/mkvlib/mkv.go b/mkvlib/mkv.go index 01034fa..cad2cc4 100644 --- a/mkvlib/mkv.go +++ b/mkvlib/mkv.go @@ -67,7 +67,7 @@ func (self *mkvProcessor) DumpMKV(file, output string, subset bool, lcb logCallb ec := 0 obj := self.GetMKVInfo(file) if obj == nil { - printLog(lcb, `Failed to get the file info: "%s".`, file) + printLog(lcb, LogError, `Failed to get the file info: "%s".`, file) return false } attachments := make([]string, 0) @@ -124,7 +124,7 @@ func (self *mkvProcessor) DumpMKV(file, output string, subset bool, lcb logCallb ec++ } } else { - printLog(lcb, `This file is not has the subtitles & attachments: "%s"`, file) + printLog(lcb, LogInfo, `This file is not has the subtitles & attachments: "%s"`, file) } return ec == 0 } @@ -132,7 +132,7 @@ func (self *mkvProcessor) DumpMKV(file, output string, subset bool, lcb logCallb func (self *mkvProcessor) CheckSubset(file string, lcb logCallback) (bool, bool) { obj := self.GetMKVInfo(file) if obj == nil { - printLog(lcb, `Failed to get the file info: "%s".`, file) + printLog(lcb, LogError, `Failed to get the file info: "%s".`, file) return false, true } ass := false @@ -210,10 +210,10 @@ func (self *mkvProcessor) DumpMKVs(dir, output string, subset bool, lcb logCallb p = path.Join(output, d, f) if !self.DumpMKV(item, p, subset, lcb) { ok = false - printLog(lcb, `Failed to dump the file: "%s".`, item) + printLog(lcb, LogError, `Failed to dump the file: "%s".`, item) } else { _ok++ - printLog(lcb, "Dump (%d/%d) done.", _ok, l) + printLog(lcb, LogProgress, "Dump (%d/%d) done.", _ok, l) } } return ok @@ -226,11 +226,11 @@ func (self *mkvProcessor) QueryFolder(dir string, lcb logCallback) []string { for i, file := range files { a, b := self.CheckSubset(file, lcb) if b { - printLog(lcb, `Failed to check subset for file: "%s".`, file) + printLog(lcb, LogError, `Failed to check subset for file: "%s".`, file) } else if !a { lines = append(lines, file) } - printLog(lcb, "Query (%d/%d) done.", i+1, l) + printLog(lcb, LogProgress, "Query (%d/%d) done.", i+1, l) } return lines } @@ -258,9 +258,9 @@ func (self *mkvProcessor) CreateMKVs(vDir, sDir, fDir, tDir, oDir, slang, stitle fn += ".mkv" } if _a, _ := isExists(fn); _a && self.noverwrite { - printLog(lcb, `@Warning@ Existing file: "%s",skip.`, fn) + printLog(lcb, LogInfo, `Existing file: "%s",skip.`, fn) _ok++ - printLog(lcb, "Create (%d/%d) done.", _ok, l) + printLog(lcb, LogProgress, "Create (%d/%d) done.", _ok, l) continue } for _, sub := range tmp { @@ -292,10 +292,10 @@ func (self *mkvProcessor) CreateMKVs(vDir, sDir, fDir, tDir, oDir, slang, stitle } if ec > 0 { ok = false - printLog(lcb, `Failed to create the file: "%s".`, item) + printLog(lcb, LogError, `Failed to create the file: "%s".`, item) } else { _ok++ - printLog(lcb, "Create (%d/%d) done.", _ok, l) + printLog(lcb, LogInfo, "Create (%d/%d) done.", _ok, l) } } _ = os.RemoveAll(tDir) @@ -317,9 +317,9 @@ func (self *mkvProcessor) MakeMKVs(dir, data, output, slang, stitle string, lcb fn += ".mkv" } if _a, _ := isExists(fn); _a && self.noverwrite { - printLog(lcb, `@Warning@ Existing file: "%s",skip.`, fn) + printLog(lcb, LogInfo, `Existing file: "%s",skip.`, fn) _ok++ - printLog(lcb, "Make (%d/%d) done.", _ok, l) + printLog(lcb, LogProgress, "Make (%d/%d) done.", _ok, l) continue } p = path.Join(data, d, f) @@ -330,10 +330,10 @@ func (self *mkvProcessor) MakeMKVs(dir, data, output, slang, stitle string, lcb tracks := append(subs, asses...) if !self.CreateMKV(item, tracks, attachments, fn, slang, stitle, true) { ok = false - printLog(lcb, `Failed to make the file: "%s".`, item) + printLog(lcb, LogError, `Failed to make the file: "%s".`, item) } else { _ok++ - printLog(lcb, "Make (%d/%d) done.", _ok, l) + printLog(lcb, LogProgress, "Make (%d/%d) done.", _ok, l) } } return ok @@ -515,11 +515,11 @@ func (self *mkvProcessor) CreateTestVideo(asses []string, s, fontdir, enc string ok := self.CreateBlankOrBurnVideo(0, s, enc, v, fontdir, _output) if !ok { ec++ - printLog(lcb, `Failed to create the test video file: "%s"`, _output) + printLog(lcb, LogError, `Failed to create the test video file: "%s"`, _output) _ = os.Remove(_output) } else { _ok++ - printLog(lcb, "CT (%d/%d) done.", _ok, l) + printLog(lcb, LogProgress, "CT (%d/%d) done.", _ok, l) } } return ec == 0 @@ -542,16 +542,16 @@ func (self *mkvProcessor) CreateTestVideo(asses []string, s, fontdir, enc string s = path.Join(d, fmt.Sprintf("%s.mp4", n)) if !self.CreateBlankOrBurnVideo(t.Milliseconds(), "", enc, "", "", s) { ok = false - printLog(lcb, `Failed to create the temp video file: "%s".`, s) + printLog(lcb, LogError, `Failed to create the temp video file: "%s".`, s) } } if ok { output := path.Join(d, fmt.Sprintf("%s.mkv", n)) if !self.CreateMKV(s, asses, _fonts, output, "", "", true) { ok = false - printLog(lcb, `Failed to create the test video file: "%s".`, output) + printLog(lcb, LogError, `Failed to create the test video file: "%s".`, output) } else { - printLog(lcb, "CT done.") + printLog(lcb, LogProgress, "CT done.") } } if _t { -- cgit v1.2.1