From: Oleg Broytman Date: Thu, 10 May 2018 21:25:42 +0000 (+0300) Subject: Feat(glst): Report imported glst counter X-Git-Tag: 0.1.1~7 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=f5f7e40267b3e58f4999c4b00a7b8802e2021958;p=m_librarian.git Feat(glst): Report imported glst counter --- diff --git a/scripts/ml-import.py b/scripts/ml-import.py index 07c7fbb..bc4b6b3 100755 --- a/scripts/ml-import.py +++ b/scripts/ml-import.py @@ -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: diff --git a/scripts/ml-initdb.py b/scripts/ml-initdb.py index 6535d45..71d3598 100755 --- a/scripts/ml-initdb.py +++ b/scripts/ml-initdb.py @@ -1,6 +1,5 @@ #! /usr/bin/env python -from __future__ import print_function import argparse from m_librarian.config import get_config from m_librarian.db import open_db, init_db @@ -17,8 +16,9 @@ if __name__ == '__main__': open_db(args.database) init_db() - old, new = import_glst() - if old: - print("Imported %d genres (ignored %d existing)" % (new, old)) + 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" % new) + print("Imported %d genres" % count_new)