Пример #1
0
            if len(r) >2: oname_priakor = r[2]

        fname = l[0].strip()
        ime = ime.strip()
        priakor = priakor.strip()
        oname_priakor = oname_priakor.strip()
        oname = lat2cyr.zvuchene.cyr2lat( oname_priakor) + '_' + fname
        if verbose: print >>sys.stderr, ' :', fname, priakor, ime, ':', oname

        xfname = os.path.splitext( fname)[0]
        spisyk[ xfname] = oname,priakor,ime
    return spisyk

if __name__ == '__main__':
    import optz
    optz.add1( 'nothing', '-n', help= 'do nothing')
    optz.add1( 'force',   '-f', )
    optz.add1( 'verbose', '-v', )
    optz.add1( 'cjpeg', )
    optz.add1( 'stdin', )
    options,args = optz.get()

    fname_spisyk = args.pop(0)
    spisyk = parse( fname_spisyk, verbose= options.verbose)
    if options.nothing: raise SystemExit

    from nadpis1pil import label
    opath = 'nadpisi'

    for fname in args:
        xfdir,xfname = os.path.split( fname)
Пример #2
0
    if config.touch and total:
        import time
        s = time.localtime()
        tm_year = s.tm_year
        tm_mon = tm_mday = 1
        tm_hour= int(total/3600)
        tm_min = int((total+29)/60)
        tm_sec = 0#int(total-tm_min*60)
        tm_wday= tm_yday= tm_isdst= -1

        s = tm_year, tm_mon, tm_mday,  tm_hour, tm_min, tm_sec,  tm_wday,tm_yday,tm_isdst
        tm = time.mktime(s)
        os.utime( curdir or all[0], (tm,tm) )
    return total

if __name__ == '__main__':
    import optz
    optz.add1( 'verbose',   '-v')
    optz.add1( 'touch',     '-t')
    optz.add1( 'mp3', )
    optz.add1( 'wav', )
    options,args = optz.get()

    total=0
    for curdir in (args or [os.getcwd()]):
        total += dirsize( curdir, config= options)

    print 'total:', minsec(total)

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