def accept(path):
     parent_dir, bname_noext, dotext = files.split3(path)
     return bname_noext == cue_bname_noext and dotext[1:] in AUDIO_EXTS
    parser.add_argument('-t', '--output_filename_format',
        help="Ouptut filename format. Same as shnsplit -t. Default '%%n - %%p - %%t'",
        default="%n - %p - %t")

    args = parser.parse_args(sys.argv[1:])
    output_format = args.output_format
    remove_original_files = args.remove_original_files
    output_filename_format = args.output_filename_format

    errors = []

    for cue_path in files.find(u'.'):

        if cue_path.endswith('.cue'):

            parent_dir, cue_bname_noext, dotext = files.split3(cue_path)

            def accept(path):
                parent_dir, bname_noext, dotext = files.split3(path)
                return bname_noext == cue_bname_noext and dotext[1:] in AUDIO_EXTS

            audio_file_candidates = filter(accept, os.listdir(parent_dir))

            ncandidates = len(audio_file_candidates)

            if ncandidates == 0: #only one candidate, so take him!
                error = "No audio candidates for:\n%s" % cue_path
                print error
                errors.append(error)

            elif ncandidates > 1: