From 5d81aa080a9184466ee950518a192bf8234c8c11 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 31 May 2016 00:18:49 +0300 Subject: [PATCH] Print count after the list --- ChangeLog | 2 ++ m_librarian/translations/ru_RU.mo | Bin 896 -> 933 bytes m_librarian/translations/ru_RU.po | 7 +++++-- scripts/ml-search.py | 25 +++++++++++++++++++------ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b0d6cf..2e8040a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ Version 0.0.10 (2016-05-??) + Print count after the list + Rename -d/--details options to -v/--verbose Version 0.0.9 (2016-05-30) diff --git a/m_librarian/translations/ru_RU.mo b/m_librarian/translations/ru_RU.mo index 26de52cfe407f2bc5ed213b2a02586f4f6685e4a..ce61803f80a6cf3ee5178e2a825ba03b8bfc756e 100644 GIT binary patch delta 395 zcmZo*U&>y8Pl#nI0}u!Ru?!H;0b+3wn-NF=K?RUz2hx>5niEJj0%;Z?-3=9=02QAB zq*;ODi=gr=p!~H!ngb}l8A|T~(riHfQ6LR8r=H;qgu!qTNP`Tx2Bq%+X>lNa1jJlG z@n1{~417SEl^J572#^NxWr4H^kk$dxAcGyD@*Yt6Kp@Qn6iA4PhKGA2V%a-sf-q^ iZuzBoDVygoE@0%Hdtt+cofo!T*m_~_g?*E)nB4%sMJWaV delta 359 zcmZ3=-oRdePl#nI0}${7u?!GT0b+3==3xX9K#&2X*@1K>kmdx^g+Q7GNLNF}8=&GH zK$;aOJ_#y614wfK`E#N4G9b+c$&Zp?nV@4KgPXDjox*K_18i%iA+B z= 1: print "(id=%d)" % author.id, print + print_count(authors) def _search_books(case_sensitive, search_type, args): @@ -129,7 +134,7 @@ def _search_books(case_sensitive, search_type, args): books = search_books(search_type, case_sensitive, values, join_expressions, orderBy=('series', 'ser_no', 'title')) if args.count: - print books.count() + print_count(books) return for book in books: print book.title.encode(default_encoding), @@ -167,6 +172,7 @@ def _search_books(case_sensitive, search_type, args): book.size, _("bytes").encode(default_encoding) print " ", _("Deleted").encode(default_encoding), ":", \ _(str(book.deleted)).encode(default_encoding) + print_count(books) def _search_extensions(case_sensitive, search_type, args): @@ -178,7 +184,7 @@ def _search_extensions(case_sensitive, search_type, args): extensions = search_extensions(search_type, case_sensitive, values, orderBy='name') if args.count: - print extensions.count() + print_count(extensions) return for ext in extensions: print ext.name.encode(default_encoding), \ @@ -186,6 +192,7 @@ def _search_extensions(case_sensitive, search_type, args): if args.verbose >= 1: print "(id=%d)" % ext.id, print + print_count(extensions) def _search_genres(case_sensitive, search_type, args): @@ -194,7 +201,7 @@ def _search_genres(case_sensitive, search_type, args): case_sensitive = _guess_case_sensitivity(values) genres = search_genres(search_type, case_sensitive, values, orderBy='name') if args.count: - print genres.count() + print_count(genres) return for genre in genres: names = filter(None, (genre.name, genre.title)) @@ -204,6 +211,7 @@ def _search_genres(case_sensitive, search_type, args): if args.verbose >= 1: print "(id=%d)" % genre.id, print + print_count(genres) def _search_languages(case_sensitive, search_type, args): @@ -212,13 +220,18 @@ def _search_languages(case_sensitive, search_type, args): case_sensitive = _guess_case_sensitivity(values) else: values = {} - for lang in search_languages(search_type, case_sensitive, values, - orderBy='name'): + languages = search_languages(search_type, case_sensitive, values, + orderBy='name') + if args.count: + print_count(languages) + return + for lang in languages: print lang.name.encode(default_encoding), \ (u"(%s: %d)" % (_('books'), lang.count)).encode(default_encoding), if args.verbose >= 1: print "(id=%d)" % lang.id, print + print_count(languages) if __name__ == '__main__': -- 2.39.5