예제 #1
0
def izvadi( fime, srezove, dirime, nomer =None, ime ='', opfx =''):
    log()
    c = Cutter()
    if isinstance( srezove, str):
        srezove = [s.split('#',1)[0] for s in srezove.split('\n')]
        v = ' '.join( s for s in srezove if s.strip())
        v = rec2dir.opravi_tireta( v, spc=' ')
        c.readcuts( v)
    elif isinstance( srezove, dict):
        for k,v in srezove.items():
            c.name = str(k)
            v = rec2dir.opravi_tireta( v, spc=' ')
            c.readcuts( v)
            c.add()
    else:
        assert 0, (srezove, fime)

    c.save( infile= fime, path= dirime,
        ofile_as_sfx = ''.join( '-'+str(f) for f in [
            #opfx or dirime.rstrip('/'),
            #fime,
            ime, nomer]
            if f),
        do_nothing= not optz.zapis,
        #verbose= True
        )
예제 #2
0
        options.inpath = dirname( cutfile)
        cutfile = open( cutfile)

    for c in eutf.readlines( cutfile):
        c = c.strip()
        if not c or c.startswith( '#'): continue
        if assign_params( c): continue
        if not c.replace( '=',''):  #only ===== ; force filename follows
            if cutter:
                cutter.save()
                cutter = None
            #print '======'
            options.infile = None
            continue
        if sum( c.endswith( '.'+ext) for ext in 'flac wav mp3'.split()):
            if cutter:
                cutter.save()
                cutter = None
            print( 'new-infile=', c)
            options.infile = c
            continue
        if not cutter: cutter = Cutter()
        if options.verbose: print( '<', c)
        cutter.readline( c)

    if cutter:
        cutter.save()
        cutter = None

# vim:ts=4:sw=4:expandtab