X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=scripts%2Fml-import.py;h=07c7fbb47e36f69122f81746616380ac737f3f99;hb=dff2afc433b73f1b114f36f1de93471d2217eff2;hp=47c6b1b2056e39139221acb474571db305edf75c;hpb=0118f85c754acb6ddf519f32362b4c91c032ade6;p=m_librarian.git diff --git a/scripts/ml-import.py b/scripts/ml-import.py index 47c6b1b..07c7fbb 100755 --- a/scripts/ml-import.py +++ b/scripts/ml-import.py @@ -27,8 +27,9 @@ if __name__ == '__main__': open_db(args.database) init_db() import_glst() + use_pbar = ttyProgressBar and not args.no_pbar and sys.stdout.isatty() for inpx in args.inpx: - if ttyProgressBar and not args.no_pbar: + if use_pbar: if len(inpx) > 25: pbar_fname = inpx[:22] + '...' else: @@ -40,4 +41,11 @@ if __name__ == '__main__': print("Ok") else: import_inpx(inpx) - update_counters() + if use_pbar: + print("Updating counters", end=': ') + sys.stdout.flush() + pbar = ml_ttyProgressBar() + update_counters(pbar_cb=pbar) + print("Ok") + else: + update_counters()