From 0ab24cc7c0ef6b8a79c857fef29783c31416765e Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Fri, 8 Nov 2013 22:06:57 +0200 Subject: [PATCH] added option for activities --- aerofs/aerofs-transfers | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/aerofs/aerofs-transfers b/aerofs/aerofs-transfers index 361f00f..6e593a9 100755 --- a/aerofs/aerofs-transfers +++ b/aerofs/aerofs-transfers @@ -42,6 +42,8 @@ You can tap in to an existing log with: parser.add_argument("--no-colors",'--nc',action="store_false",dest="colors",default=True, help="Disable colored output") + parser.add_argument("-a",action="store_false",dest="activities",default=True, + help="Disable activities output") parser.add_argument("--version",action='version', version=VERSION) options=parser.parse_args() @@ -103,7 +105,7 @@ def remove_running(stats): stats['running'].pop(e[0]) stats['files'].pop(e[0]) # Remove Done/Fail if there are too many: - if len(stats['running'])>(stats['size'][0]-3): + if len(stats['running'])>(stats['size'][0]-6): for e in enumerate(stats['running']): if e[1][2]=='Done': stats['running'].pop(e[0]) @@ -137,7 +139,10 @@ def str_short(s,stats): def print_stats(stats): ''' Prints logged errors, and the status line ''' #sys.stdout.write(SAVE) - e=5 + if options.activities: + e=5 + else: + e=0 sys.stdout.write(pos(e+1,0)+"="*10+"AeroFS Transfers"+"="*10+" "+human_time()+CLRLN) if (stats['running']): sys.stdout.write(pos(e+2,0)+"Last update: "+stats['running'][0][0]+CLRLN) @@ -150,7 +155,7 @@ def print_stats(stats): colorize(ex[1][2].ljust(6)), str_short(ex[1][3],stats)])+ CLRLN) - for i in range(stats['size'][0]-3-len(stats['running'])): + for i in range(stats['size'][0]-6-len(stats['running'])): sys.stdout.write(pos(e+4+ex[0]+i,0)+" "+CLRLN) sys.stdout.write(DOWN+CLRBLN+CLRLN) @@ -242,7 +247,7 @@ while 1: if not line: raise EndProgram - if ( datetime.now() - stats['time'] > timedelta(seconds=30) ): + if ( datetime.now() - stats['time'] > timedelta(seconds=30) ) and options.activities: print_activities() stats['time'] = datetime.now()