From 720bfdf7d37a187c919037ec0b8e05b2d751b638 Mon Sep 17 00:00:00 2001 From: Mikhail Osipov Date: Wed, 6 Nov 2013 03:56:18 +0400 Subject: config update --- cutter.py | 8 +++++++- cutter/config.py | 16 +++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cutter.py b/cutter.py index cd86c50..525fa59 100755 --- a/cutter.py +++ b/cutter.py @@ -94,6 +94,9 @@ def parse_args(): dest="use_tempdir", action="store_false", help="do not use temporary directory") + general.add_option("--no-progress", + dest="show_progress", action="store_false") + general.add_option("--tracks", dest="tracks", help="select tracks") parser.add_option_group(general) @@ -248,7 +251,10 @@ def process_options(opt): opt.tracks = tracks - opt.show_progress = os.isatty(sys.stdout.fileno()) + if not os.isatty(sys.stdout.fileno()): + opt.show_progress = False + elif opt.show_progress is None: + opt.show_progress = config.PROGRESS return True diff --git a/cutter/config.py b/cutter/config.py index d1a5f39..610f14f 100644 --- a/cutter/config.py +++ b/cutter/config.py @@ -14,15 +14,19 @@ def __create_default(name): fp = open(name, "w") fp.write( -"""[encoding] -# type = - +"""[general] # where to place new files dir = . # use temporary directory for converted files use_tempdir = false +# show progress in percents +progress = false + +[encoding] +# type = + [output] # sample_rate = # channels = @@ -84,9 +88,11 @@ cfg = CfgParser() if not cfg.read(os.path.expanduser(CONFIG_FILE_PATH)): __create_default(CONFIG_FILE_PATH) -DIR = cfg.get("encoding", "dir", ".") +DIR = cfg.get("general", "dir", ".") +USE_TEMPDIR = cfg.getbool("general", "use_tempdir") +PROGRESS = cfg.getbool("general", "progress") + TYPE = cfg.get("encoding", "type") -USE_TEMPDIR = cfg.getbool("encoding", "use_tempdir") SAMPLE_RATE = cfg.getint("output", "sample_rate") CHANNELS = cfg.getint("output", "channels") -- cgit v1.2.3-70-g09d2