]> git.phdru.name Git - m_librarian.git/blobdiff - scripts/ml-import.py
Version 0.1.0: Web-interface
[m_librarian.git] / scripts / ml-import.py
index 56ff8a670df980b3ad09b6c0dd72646c8bfcf91d..07c7fbb47e36f69122f81746616380ac737f3f99 100755 (executable)
@@ -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:
@@ -37,6 +38,14 @@ if __name__ == '__main__':
             sys.stdout.flush()
             pbar = ml_ttyProgressBar()
             import_inpx(inpx, pbar_cb=pbar)
+            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()