diff -ur v14/snddiv.py v15/snddiv.py --- v14/snddiv.py 2022-05-03 00:56:16.000000000 +0900 +++ v15/snddiv.py 2022-05-03 15:22:15.000000000 +0900 @@ -81,7 +81,7 @@ return empty.to_attr( e, locals() ) -def snd_new( data, sudo_passwd, cache ): +def snd_new( data, sudo_passwd, cache, step_sec ): inf = data.inf last_sec = inf.smp_to_sec( inf.smp_n ) dbg.out( 'last_sec={}'.format( last_sec ) ) @@ -160,8 +160,6 @@ e.fin = True return get_dat_sec( e.sec, reverse, shift ) - step_sec = 5.0 - if reverse: sec_t = e.sec sec_f = max( e.sec - step_sec, 0 ) @@ -273,16 +271,17 @@ sudo_passwd = a.pop_str('-S') silent = a.is_pop('-silent') cache = a.is_pop( '-cache' ) + step_sec = a.pop_v( '-step_sec', 5.0 ) filename_mp3 = a.pop() if not filename_mp3: - dbg.help_exit( '[-g] [-S sudo_passwd] [-silent] [-cache] filename_mp3' ) + dbg.help_exit( '[-g] [-S sudo_passwd] [-silent] [-cache] [-step_sec 5.0] filename_mp3' ) snd_ut.silent = silent dbg_out = lambda s, tail='\n': None if silent else dbg.out data = snd_ut.data_new(filename_mp3) - snd = snd_new( data, sudo_passwd, cache ) + snd = snd_new( data, sudo_passwd, cache, step_sec ) rdr = io_ut.reader_new( sys.stdin, 1, no_buf=True ) diff -ur v14/snddiv_gui.py v15/snddiv_gui.py --- v14/snddiv_gui.py 2020-09-23 20:59:31.000000000 +0900 +++ v15/snddiv_gui.py 2022-05-03 15:22:15.000000000 +0900 @@ -36,6 +36,9 @@ if not s: sys.exit(1) + cmd = "dbg.out( '{} ({})'.format( filename_mp3, dbg.quantize( snd.last_sec, '.01' ) ) )" + s = comm( cmd, rdr.readline ).strip() + name = wxo.label_new( s ) play_lbs = ( ' Play |>', ' Play <|', 'Pause ||' ) btn_play = wxo.toggle_new( play_lbs[ 0 ], min_w=104 ) @@ -45,8 +48,8 @@ cbox_reverse = wxo.wx_new( wx.CheckBox, 'reverse' ) is_reverse = lambda : cbox_reverse.GetValue() - speed_lbs = ('x4', 'x2', 'x1', 'x0.5') - shifts = (2, 1, 0, -1) + speed_lbs = ( 'x32', 'x16', 'x8', 'x4', 'x2', 'x1', 'x0.5', 'x0.25' ) + shifts = ( 5, 4, 3, 2, 1, 0, -1, -2 ) menu_speed = wxo.menu_new( speed_lbs, None, 'x1', shifts ) get_shift = lambda : wxo.menu_get( menu_speed ).v @@ -73,7 +76,8 @@ def pos_update(): cmd = 'dbg.out("{}".format( snd.get_sec() ) )' s = comm(cmd, rdr.readline).strip() - s = str( Decimal(s).quantize( Decimal('.01') ) ) + #s = str( Decimal(s).quantize( Decimal('.01') ) ) + s = str( dbg.quantize( s, '.01' ) ) wx.CallAfter( pos.SetLabel, s ) btn_save = wxo.button_new( 'save', min_w=50 ) @@ -158,6 +162,7 @@ wp = wxo.wp lsts = [ + wp( [ wp( name ) ] ), wp( [ wp( btn_rw ), wp( btn_play, prop=1 ), wp( btn_ff ) ], prop=1, flag=wx.EXPAND ), wp( [ wp( cbox_reverse ), wp( menu_speed ) ] ), wp( [ wp( pos ), wp( btn_div ), wp( area ), wp( btn_save, prop=1 ) ], flag=wx.EXPAND ),