added option for activities
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user