summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Osipov <mike.osipov@gmail.com>2013-11-06 03:56:18 +0400
committerMikhail Osipov <mike.osipov@gmail.com>2013-11-06 03:56:18 +0400
commit720bfdf7d37a187c919037ec0b8e05b2d751b638 (patch)
treeaf3928211ffe945a0cee84af9ba04b78b1f58577
parent425a97f98026d154651feac9cb0884a1f8af7cc5 (diff)
config update
-rwxr-xr-xcutter.py8
-rw-r--r--cutter/config.py16
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 = <default format 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 = <default format 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")