Ignore:
Timestamp:
Nov 5, 2018, 2:02:20 PM (20 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master
Children:
bc1ed63
Parents:
f8c75aa
Message:

[py] move cut_slice from cut to cmd to avoid cyclic import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/aubio/cut.py

    rf8c75aa rdc74f69  
    66
    77import sys
    8 import warnings
    9 from aubio.cmd import AubioArgumentParser
    10 from aubio.slicing import slice_source_at_stamps
    11 
     8from aubio.cmd import AubioArgumentParser, _cut_slice
    129
    1310def aubio_cut_parser():
     
    137134    return timestamps, total_frames
    138135
    139 
    140 def _cut_slice(options, timestamps):
    141     # cutting pass
    142     nstamps = len(timestamps)
    143     if nstamps > 0:
    144         # generate output files
    145         timestamps_end = None
    146         if options.cut_every_nslices:
    147             timestamps = timestamps[::options.cut_every_nslices]
    148             nstamps = len(timestamps)
    149         if options.cut_until_nslices and options.cut_until_nsamples:
    150             msg = "using cut_until_nslices, but cut_until_nsamples is set"
    151             warnings.warn(msg)
    152         if options.cut_until_nsamples:
    153             lag = options.cut_until_nsamples
    154             timestamps_end = [t + lag for t in timestamps[1:]]
    155             timestamps_end += [1e120]
    156         if options.cut_until_nslices:
    157             slice_lag = options.cut_until_nslices
    158             timestamps_end = [t for t in timestamps[1 + slice_lag:]]
    159             timestamps_end += [1e120] * (options.cut_until_nslices + 1)
    160         slice_source_at_stamps(options.source_uri,
    161                 timestamps, timestamps_end = timestamps_end,
    162                 output_dir = options.output_directory,
    163                 samplerate = options.samplerate,
    164                 create_first = options.create_first)
    165 
    166136def main():
    167137    parser = aubio_cut_parser()
Note: See TracChangeset for help on using the changeset viewer.