parser.add_option("-d", "--default", dest="default", metavar="TRACKNUM", default=None,
	help="Changes the default track to the tracknumber specified. Only useful when remuxing with -r. If not specified, when remuxing the default is to use the replaced default track.")
parser.add_option("-k", "--keeporig", action="store_true", dest="keeporig", default=None,
	help="Keeps the original subtitle tracks in the remuxed file, therefore only useful when remuxing with -r/--remux. Otherwise only the replaced subtracks will be remuxed.")
parser.add_option("-p", "--suffix", dest="suffix", metavar="SUFFIX", default=None,
	help="Adds SUFFIX to the remuxed file. Hence only applied when using -r/--remux")
parser.add_option("--removecrc", action="store_true", dest="removecrc", default=None,
	help="Removes CRC's from remuxed filenames. Hence only applied when using -r/--remux. WARNING: Has the potential to severely mangle filenames. Regex used: [^a-zA-Z0-9][a-fA-F0-9]{8}[^a-zA-Z0-9]")
parser.add_option("--noclean", action="store_true", dest="noclean", default=None,
	help="If remuxing, don't clean up temporary extracted subfiles. Default is to remove temp files when remuxing.")
parser.add_option("--debug", action="store_true", dest="debug", default=None,
	help="Print debug stuff")
	
(options, args) = parser.parse_args()

combine_options_fromfile(defaults, options, "subextractreplace.conf", __file__)

if options.debug:
	log.level=DEBUG
	for x in options.__dict__:
		log.debug("%s = %s" % (x, options.__dict__[x]))
		
if (not options.mkvtoolnix) or (not exists(join(options.mkvtoolnix,"mkvinfo.exe"))) or (not exists(join(options.mkvtoolnix,"mkvextract.exe")))\
	or (not exists(join(options.mkvtoolnix,"mkvmerge.exe"))):
	log.error("MKVtoolnix files not found. -h for help")
	exit(1)

if options.file:
	if isabs(options.file):
		if not exists(options.file):
			log.error("Replacement file (%s) not found." % options.file)
Exemple #2
0
	help="Show progress per drive. This is only accurate when processing whole drive.")
parser.add_option("--max-depth", dest="depth", metavar="DEPTH", default=None,
	help="To what depth of nesting will be displayed. By default this is infinite, but if you need to overrite your config, you can use -1 to mean the same.")
parser.add_option("--min-size", dest="minsize", metavar="SIZE", default=None,
	help="Files/dirs will need to be at least this big before being printed. Size is in bytes. Default: no limit. If you need to overrite your config, you can use 0 to mean the same.")
parser.add_option("--max-size", dest="maxsize", metavar="SIZE", default=None,
	help="Files/dirs will need to be at most this big before being printed. Size is in bytes. Default: no limit. If you need to overrite your config, you can use 0 to mean the same.")
parser.add_option("--sort-by", dest="sortby", default=None,
	help="Sort by one of the following: name size. Default: name")
parser.add_option("--debug", dest="debug", default=None,
	help="Print some debug infos. 0=nothing 1=print 2=file 3=both")

(options, args) = parser.parse_args()
#grab defaults from file, and then override with commandlines.

combine_options_fromfile(defaults, options, "treeprinter.conf", __file__)

if options.output:
	LogUtil.f = codopen(options.output, "w", "utf-8")

if options.debug:
	log.level=DEBUG
	
try: options.rounding = int(options.rounding)
except: 
	log.warn("Rounding not int, using default: 5")
	options.rounding = int(defaults["rounding"])
if options.depth:
	try: options.depth = int(options.depth)
	except:
		log.warn("Max depth not int, using default: none (-1)")