diff options
| author | ac79b0c6 <[email protected]> | 2022-05-20 18:16:59 +0800 |
|---|---|---|
| committer | ac79b0c6 <[email protected]> | 2022-05-20 18:16:59 +0800 |
| commit | 25a09d120098574711a3f007f35df44771da387c (patch) | |
| tree | 791886854bc08bcd2e54ed2a74b5a490a3816955 /mkvlib/mkv.go | |
| parent | c8c65c409de5995a2e774fc35ac82a5bfb21e137 (diff) | |
update mkvlib:add overwrite switch
Diffstat (limited to 'mkvlib/mkv.go')
| -rw-r--r-- | mkvlib/mkv.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mkvlib/mkv.go b/mkvlib/mkv.go index 46da74b..d85e8d9 100644 --- a/mkvlib/mkv.go +++ b/mkvlib/mkv.go @@ -48,6 +48,7 @@ type mkvProcessor struct { nrename bool check bool strict bool + overwrite bool } func (self *mkvProcessor) GetMKVInfo(file string) *mkvInfo { @@ -256,7 +257,7 @@ func (self *mkvProcessor) CreateMKVs(vDir, sDir, fDir, tDir, oDir, slang, stitle } else { fn += ".mkv" } - if _a, _ := isExists(fn); _a { + if _a, _ := isExists(fn); _a && !self.overwrite { printLog(lcb, `@Warning@ Existing file: "%s",skip.`, fn) _ok++ printLog(lcb, "Create (%d/%d) done.", _ok, l) @@ -315,7 +316,7 @@ func (self *mkvProcessor) MakeMKVs(dir, data, output, slang, stitle string, lcb } else { fn += ".mkv" } - if _a, _ := isExists(fn); _a { + if _a, _ := isExists(fn); _a && !self.overwrite { printLog(lcb, `@Warning@ Existing file: "%s",skip.`, fn) _ok++ printLog(lcb, "Make (%d/%d) done.", _ok, l) @@ -445,6 +446,10 @@ func (self *mkvProcessor) NRename(nrename bool) { self.nrename = nrename } +func (self *mkvProcessor) Overwrite(o bool) { + self.overwrite = o +} + func (self *mkvProcessor) CreateBlankOrBurnVideo(t int64, s, enc, ass, fontdir, output string) bool { if !self.ffmpeg { return false |
