From 315ee1386d04a3ff44088b19d9ce1c1d79218111 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 15 May 2016 23:08:26 +0300 Subject: [PATCH] By default print only titles of the found book With option `-d` also print the list of authors. --- docs-ru/command_line.rst | 8 +++++++- docs/command_line.rst | 7 ++++++- m_librarian/translations/ru_RU.mo | Bin 376 -> 417 bytes m_librarian/translations/ru_RU.po | 5 ++++- scripts/ml-search.py | 17 +++++++++++------ 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/docs-ru/command_line.rst b/docs-ru/command_line.rst index 77480b4..3d87fd9 100644 --- a/docs-ru/command_line.rst +++ b/docs-ru/command_line.rst @@ -98,7 +98,7 @@ ml-search.py Использование:: - ml-search.py [-i] [-I] [-t ...] books [-t title] [-s series] [-a archive] [-f file] + ml-search.py [-i] [-I] [-t ...] books [-t title] [-s series] [-a archive] [-f file] [-d] Искать и печатать список книг по заголовку, серии, архиву, имени файла. @@ -108,6 +108,12 @@ ml-search.py -s, --series серия Искать по серии -a, --archive архив Искать по имени архива (zip-файла) -f, --file файл Искать по имени файла (без расширения) + -d, --details Выводить больше информации о найденных книгах; + повторите эту опцию несколько раз, чтобы + получить ещё больше деталей + +По умолчанию программы выводит список заголовков найденных книг. При +использовании опции `-d` также выводится список авторов. Поиск расширений ^^^^^^^^^^^^^^^^ diff --git a/docs/command_line.rst b/docs/command_line.rst index 1298111..0e63d97 100644 --- a/docs/command_line.rst +++ b/docs/command_line.rst @@ -96,7 +96,7 @@ Book search Usage:: - ml-search.py [-i] [-I] [-t ...] books [-t title] [-s series] [-a archive] [-f file] + ml-search.py [-i] [-I] [-t ...] books [-t title] [-s series] [-a archive] [-f file] [-d] Search and print a list of books by title, series, archive or file name. @@ -106,6 +106,11 @@ Options:: -s, --series series Search by series -a, --archive archive Search by archive (zip file) -f, --file file Search by file name (without extension) + -d, --details Output more details about books; + repeat for even more details + +By default the program prints only titles of the found book. With one +option `-d` it also prints the list of authors. Extension search ^^^^^^^^^^^^^^^^ diff --git a/m_librarian/translations/ru_RU.mo b/m_librarian/translations/ru_RU.mo index dc37a20dbfeeae09030e2b1c366a014e248baed1..6fa4c1b28ae4bebe0f915af03b0488b97b71fc2a 100644 GIT binary patch delta 146 zcmeytw2(RLo)F7a1|VPtVi_Pd0b*7l_5orLNC09^AWj5gka#u_i!(AX6ar~JAnpXR zIe_#GAPqzeOh61W3l1DhOEU6{G>SDR286Si>Kd9(Tzyo0!i7y2n=b6T*r0K-Ta)3! Nt_yoF?6|O*0RZ-t9G(CG delta 105 zcmZ3;{DUdro)F7a1|VPpVi_RT0b*7lwgF-g2moRbKM;t;85tPDfiwpY=L6Y51O_0z bFfcJIoW)qz$a3P*qa3>~?7gt#!e#~lI7SaC diff --git a/m_librarian/translations/ru_RU.po b/m_librarian/translations/ru_RU.po index 91ffe2c..4a9f904 100644 --- a/m_librarian/translations/ru_RU.po +++ b/m_librarian/translations/ru_RU.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.0.3\n" "POT-Creation-Date: 2016-03-29\n" -"PO-Revision-Date: 2016-03-29\n" +"PO-Revision-Date: 2016-05-15\n" "Last-Translator: Oleg Broytman \n" "Language-Team: None yet\n" "MIME-Version: 1.0\n" @@ -14,5 +14,8 @@ msgstr "" "Content-Transfer-Encoding: 8-bit\n" "Generated-By: pygettext.py 1.5\n" +msgid "Author(s)" +msgstr "Автор(ы)" + msgid "books" msgstr "книг" diff --git a/scripts/ml-search.py b/scripts/ml-search.py index 6f71d0a..fa85f90 100755 --- a/scripts/ml-search.py +++ b/scripts/ml-search.py @@ -62,12 +62,14 @@ def _search_books(case_sensitive, args): for book in search_books(args.search_type, case_sensitive, values, orderBy='title'): print book.title.encode(default_encoding) - for author in book.authors: - names = filter(None, - (author.surname, author.name, author.misc_name)) - fullname = u' '.join(names) - print fullname.encode(default_encoding), - print + if args.details > 0: + print " ", _("Author(s)"), ":", + for author in book.authors: + names = filter(None, + (author.surname, author.name, author.misc_name)) + fullname = u' '.join(names) + print fullname.encode(default_encoding), + print def _search_extensions(case_sensitive, args): @@ -141,6 +143,9 @@ if __name__ == '__main__': parser.add_argument('-s', '--series', help='search by series') parser.add_argument('-a', '--archive', help='search by archive (zip file)') parser.add_argument('-f', '--file', help='search by file name') + parser.add_argument('-d', '--details', action='count', + help='output more details about books; ' + 'repeat for even more details') parser.set_defaults(func=_search_books) parser = subparsers.add_parser('ext', help='Search extensions') -- 2.39.5