From fe3fc0c3c556e1925c6c545d28f89f41d7148e23 Mon Sep 17 00:00:00 2001 From: mikeos Date: Thu, 25 Jul 2013 18:20:41 +0400 Subject: search cue in specified dir if cutter's argument is dir --- cutter | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cutter b/cutter index 1b7f846..0a531dd 100755 --- a/cutter +++ b/cutter @@ -587,6 +587,15 @@ class CueSplitter: trackname = self.track_name(track) printf("%s\n", os.path.join(self.dest, trackname)) +def find_cuefile(path): + for file in os.listdir(path): + fullname = os.path.join(path, file) + if os.path.isfile(fullname) and file.endswith(".cue"): + return fullname + + printerr("no cue file") + sys.exit(1) + def main(): options, args = parse_args() process_options(options) @@ -601,6 +610,11 @@ def main(): raise StopIteration cuepath = to_unicode(args[0]) + if os.path.isdir(cuepath): + cuepath = find_cuefile(cuepath) + if options.dry_run: + debug("use cue file %s", quote(cuepath)) + try: cue = read_cue(cuepath, on_error=on_error) except StopIteration: -- cgit v1.2.3-70-g09d2