# HG changeset patch # User mdd # Date 1511609057 -3600 # Node ID 821c02fa7070aff1b8908b9025947b047b0832fd # Parent f436a7f94c6a64355ffd137bfc4732e135c74804 do not overwrite output file if exists diff -r f436a7f94c6a -r 821c02fa7070 ts2mkv.py --- a/ts2mkv.py Fri Nov 24 23:42:30 2017 +0100 +++ b/ts2mkv.py Sat Nov 25 12:24:17 2017 +0100 @@ -143,10 +143,17 @@ if not self.filename: return None + commands = [] fn = "\\'".join(p for p in self.filename.split("'")) fn = fn.replace(" ", "\\ ") outfn = self.outfilebase + ".mkv" + # double-check: pull the kill switch and exit if outfile exists already! + # we do not want to overwrite files in accident (caused by automatic file naming) + if len(glob.glob(outfn)) > 0: + print "Output file exists: %s" % outfn + print "NOT overwriting it!" + return None outfn = "\\'".join(p for p in outfn.split("'")) outfn = outfn.replace(" ", "\\ ") @@ -221,6 +228,10 @@ self.msg_prepare += "Video Stream selected: Stream #%s\n" % v + + # TODO: Old dreambox images did a file split: .ts .ts.001 .ts.002 etc. + # Find all these files and join them! + cmd = [ "ffmpeg", "-i %s" % fn,