summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormikeos <mike.osipov@gmail.com>2013-07-25 18:20:41 +0400
committermikeos <mike.osipov@gmail.com>2013-07-25 18:20:41 +0400
commitfe3fc0c3c556e1925c6c545d28f89f41d7148e23 (patch)
treecdf564a7569e5216c0483a17d97037cb4a80032e
parent8eaba4017a519a9289ccdb4bd50eb0588741df92 (diff)
search cue in specified dir if cutter's argument is dir
-rwxr-xr-xcutter14
1 files changed, 14 insertions, 0 deletions
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: