diff --git a/files/file_list.py b/files/file_list.py index 97c6598..d0374b4 100755 --- a/files/file_list.py +++ b/files/file_list.py @@ -161,29 +161,29 @@ def checkdb(options): print_stderr("----\nDiffering files:") pad=str(max([len(x[0]) for x in differing])) for f in differing: - print_stderr(("%-"+pad+"s (%s %7s => %s %7s)")%(f[0],humanize_date(f[3]),humanize_size(f[2]), + print(("%-"+pad+"s (%s %7s => %s %7s)")%(f[0],humanize_date(f[3]),humanize_size(f[2]), humanize_date(os.path.getmtime(f[0])), humanize_size(os.path.getsize(f[0])))) if len(missing)>0: - print_stderr("----\nMissing files:") + print("----\nMissing files:") pad=str(max([len(x[0]) for x in missing])) for f in missing: - print_stderr(("%-"+pad+"s (%s %7s)")%(f[0],humanize_date(f[3]),humanize_size(f[2]))) + print(("%-"+pad+"s (%s %7s)")%(f[0],humanize_date(f[3]),humanize_size(f[2]))) (added,changed)=has_changes_additions(db,options,False) if len(added)>0: - print_stderr("----\nAdded files:") + print("----\nAdded files:") pad=str(max([len(x[0]) for x in added])) for f in added: - print_stderr(("%-"+pad+"s (%s %7s)")%(f, + print(("%-"+pad+"s (%s %7s)")%(f, humanize_date(os.path.getmtime(f)), humanize_size(os.path.getsize(f)))) - print_stderr("----\nFile check summary:") - print_stderr("Database modified: %s"%(humanize_date(os.path.getmtime(options.sqlfile)),)) - print_stderr("Checksum matches : %d"%(OK_count,)) - print_stderr("Checksum mismatch: %d"%(len(differing),)) - print_stderr("Files missing : %d"%(len(missing),)) - print_stderr("Files added : %d"%(len(added),)) + print("----\nFile check summary:") + print("Database modified: %s"%(humanize_date(os.path.getmtime(options.sqlfile)),)) + print("Checksum matches : %d"%(OK_count,)) + print("Checksum mismatch: %d"%(len(differing),)) + print("Files missing : %d"%(len(missing),)) + print("Files added : %d"%(len(added),)) def clean_dirs(dirs): @@ -328,11 +328,11 @@ def get_md5(filename,fullfile=False): md5 = hashlib.md5() with open(filename,'rb') as f: for chunk in iter(lambda: f.read(block_size), b''): - sys.stdout.write('\r %s (%02d%%)'%(ANIM[anim_i%anim_len],int(anim_i*percents_per_block))) - sys.stdout.flush() + sys.stderr.write('\r %s (%02d%%)'%(ANIM[anim_i%anim_len],int(anim_i*percents_per_block))) + sys.stderr.flush() anim_i+=1 md5.update(chunk) - sys.stdout.write('\r ') + sys.stderr.write('\r ') return md5.hexdigest() return hashlib.md5(open(filename,'rb').read(DEFAULT_CHUNK)).hexdigest()