From f5f7e40267b3e58f4999c4b00a7b8802e2021958 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 11 May 2018 00:25:42 +0300 Subject: [PATCH] Feat(glst): Report imported glst counter --- scripts/ml-import.py | 9 ++++++++- scripts/ml-initdb.py | 10 +++++----- 2 files changed, 13 insertions(+), 6 deletions(-) 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) -- 2.39.5