From: Oleg Broytman Date: Sun, 15 May 2016 20:08:26 +0000 (+0300) Subject: By default print only titles of the found book X-Git-Tag: 0.0.6~7 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=315ee1386d04a3ff44088b19d9ce1c1d79218111;p=m_librarian.git By default print only titles of the found book With option `-d` also print the list of authors. --- 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 dc37a20..6fa4c1b 100644 Binary files a/m_librarian/translations/ru_RU.mo and b/m_librarian/translations/ru_RU.mo differ 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')