]> git.phdru.name Git - m_librarian.git/blobdiff - scripts/ml-import.py
Feat(glst): Report imported glst counter
[m_librarian.git] / scripts / ml-import.py
index 169a715f217721b976dc90e98f1065bd29a92fb1..bc4b6b39ca7299cd2c17827742422b09812cb14c 100755 (executable)
@@ -26,7 +26,14 @@ if __name__ == '__main__':
 
     open_db(args.database)
     init_db()
-    import_glst()
+
+    count_old, count_new = import_glst()
+    if count_old:
+        print("Imported %d genres (ignored %d existing)" % (
+            count_new, count_old))
+    else:
+        print("Imported %d genres" % count_new)
+
     use_pbar = ttyProgressBar and not args.no_pbar and sys.stdout.isatty()
     for inpx in args.inpx:
         if use_pbar:
@@ -41,4 +48,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()