summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormikeos <mike.osipov@gmail.com>2013-09-30 02:45:07 +0400
committermikeos <mike.osipov@gmail.com>2013-09-30 03:20:34 +0400
commit21fc77c51e6cc011d200539a2426f5f9d276d210 (patch)
tree2f66a6ec306daf2d88859459f2a7bccee6678289
parent10a50690b33ca7fefc7768d156eb2b75544082ea (diff)
add wav support
-rwxr-xr-xcutter8
-rw-r--r--formats/__init__.py1
-rw-r--r--formats/wav.py19
3 files changed, 25 insertions, 3 deletions
diff --git a/cutter b/cutter
index 202f44d..8112c27 100755
--- a/cutter
+++ b/cutter
@@ -142,7 +142,7 @@ def parse_args():
enc = OptionGroup(parser, "Encoding options")
enc.add_option("-t", "--type", dest="type",
- choices = formats.supported(),
+ choices = formats.supported() + ["help"],
help="output file format")
enc.add_option("--coding", dest="coding",
@@ -161,7 +161,7 @@ def parse_args():
enc.add_option("-C", "--compression", type="int",
dest="compression", metavar="FACTOR",
- help="compression factor for output format (used for flac)")
+ help="compression factor for output format (used for flac, ogg)")
enc.add_option("--bitrate", type="int",
dest="bitrate", default=config.MP3_BITRATE,
@@ -223,6 +223,10 @@ def process_options(opt):
def choose(a, b):
return a if a is not None else b
+ if opt.type == "help":
+ printerr("supported formats: " + " ".join(formats.supported()))
+ return False
+
if opt.type is None and config.TYPE:
if not formats.issupported(config.TYPE):
printerr("invalid configuration: type '%s' is not supported", config.TYPE)
diff --git a/formats/__init__.py b/formats/__init__.py
index 7ebd9fd..60a35fc 100644
--- a/formats/__init__.py
+++ b/formats/__init__.py
@@ -1,4 +1,3 @@
-import importlib
import os
path = os.path.dirname(__file__) or "."
diff --git a/formats/wav.py b/formats/wav.py
new file mode 100644
index 0000000..76c2ed3
--- /dev/null
+++ b/formats/wav.py
@@ -0,0 +1,19 @@
+from formats.__base__ import *
+
+class WavHandler(BaseHandler):
+ name = "wav"
+ ext = "wav"
+
+ def encode(self, opt, info):
+ self.add("wav sox -")
+ self.add_sox_args(opt, info)
+ self.add("%f")
+
+ return self.build()
+
+ def tag(self, *args):
+ self.log("SKIP ")
+ return True
+
+def init():
+ return WavHandler