History

python/scripts/aubiocut: add -o, --output directory option

Paul Brossier committed 12 years ago

Commit 3f9e8e51 parent 9d1606d1 file · +8 −0Browse files

Showing the changes to python/scripts (1 of 1 file). Show all

Unified · Split

python/scripts/aubiocut+8−0
@@ -106,6 +106,10 @@ def parse_args(): · 105 unmodified lines
106106 action="store_true", dest="spectro", default=False,
107107 help="add spectrogram to the plot")
108108 """
109+ parser.add_option("-o","--output", type = str,
110+ metavar = "<outputdir>",
111+ action="store", dest="output_directory", default=None,
112+ help="specify path where slices of the original file should be created")
109113 parser.add_option("-v","--verbose",
110114 action="store_true", dest="verbose", default=True,
111115 help="make lots of noise [default]")
@@ -164,6 +168,10 @@ if __name__ == '__main__': · 52 unmodified lines
164168 # generate output filenames
165169 import os
166170 source_base_name, source_ext = os.path.splitext(os.path.basename(source_file))
171+ if options.output_directory != None:
172+ if not os.path.isdir(options.output_directory):
173+ os.makedirs(options.output_directory)
174+ source_base_name = os.path.join(options.output_directory, source_base_name)
167175 def new_sink_name(source_base_name, timestamp):
168176 return source_base_name + '_%02.3f' % (timestamp) + '.wav'
169177 # reopen source file

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t