X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=scripts%2Fml-import.py;h=bc4b6b39ca7299cd2c17827742422b09812cb14c;hb=dfa840f2de645da8dc26fa6b3b9daa51865d23c4;hp=56ff8a670df980b3ad09b6c0dd72646c8bfcf91d;hpb=935a32f3ad46cc24169afc635ffcd30ad00d5a98;p=m_librarian.git diff --git a/scripts/ml-import.py b/scripts/ml-import.py index 56ff8a6..bc4b6b3 100755 --- a/scripts/ml-import.py +++ b/scripts/ml-import.py @@ -26,9 +26,17 @@ 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 ttyProgressBar and not args.no_pbar: + if use_pbar: if len(inpx) > 25: pbar_fname = inpx[:22] + '...' else: @@ -37,6 +45,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()