Искать и печатать список авторов, чья фамилия начинается на "друг" и имя
начинается на "в", без учёта регистра.
+При использовании опции `-d` также выводится id из БД.
+
Поиск книг
^^^^^^^^^^
-l, --lang lang Искать по языку
По умолчанию программы выводит список заголовков найденных книг. При
-использовании опции `-d` также выводится список авторов и жанров, а
-также серия, к которой принадлежит книга (если принадлежит) и порядковый
-��омер книги в этой серии. С двумя опциями `-d` (`-d -d` или просто
-`-dd`) программа выводит дату файла и язык. С тремя `-d` выводятся имя
-��рхива, имя файла, расширение и размер файла, и признак, была ли книга
-помечена как удалённая.
+использовании опции `-d` также выводится id из БД, список авторов и
+жанров, а также серия, к которой принадлежит книга (если принадлежит) и
+��орядковый номер книги в этой серии. С двумя опциями `-d` (`-d -d` или
+просто `-dd`) программа выводит дату файла и язык. С тремя `-d`
+��ыводятся имя архива, имя файла, расширение и размер файла, и признак,
+��ыла ли книга ��омечена как удалённая.
Поиск расширений
Искать и печатать список расширений имён файлов по имени.
+При использовании опции `-d` также выводится id из БД.
+
Поиск жанров
^^^^^^^^^^^^
-n, --name имя Искать по названию
-t, --title заголовок Искать по заголовку
+При использовании опции `-d` также выводится id из БД.
+
Поиск языков
^^^^^^^^^^^^
Искать и печатать список языков по имени.
+При использовании опции `-d` также выводится id из БД.
+
.. vim: set tw=72 :
ml-search.py -i author -s duck -n mack
-Search and print a list of authors whose surname starts with "duck", and
+Search and print a list of authors whose surname starts with "duck" and
name starts with "mack", case insensitive.
+With one option `-d` it also prints database id.
+
Book search
^^^^^^^^^^^
-l, --lang lang Search by language
By default the program prints only titles of the found book. With one
-option `-d` it also prints the list of authors and genres, and also
-series the book belongs to (if any) and the serial number of the book in
-the series. With two options `-d` (`-d -d` or simply `-dd`) it also
-prints the file date and language. With three `-d` it prints archive
-name, file name, extension and size, and flag if the book is marked to
-be deleted.
+option `-d` it also prints database id, the list of authors and genres,
+and also series the book belongs to (if any) and the serial number of
+the book in the series. With two options `-d` (`-d -d` or simply `-dd`)
+it also prints the file date and language. With three `-d` it prints
+archive name, file name, extension and size, and flag if the book is
+marked to be deleted.
Extension search
Search and print a list of extensions by name.
+With one option `-d` it also prints database id.
+
Genres search
^^^^^^^^^^^^^
-n, --name name Search by name
-t, --title title Search by title
+With one option `-d` it also prints database id.
+
Language search
^^^^^^^^^^^^^^^
Search and print a list of languages by name.
+With one option `-d` it also prints database id.
+
.. vim: set tw=72 :
names = filter(None, (author.surname, author.name, author.misc_name))
fullname = u' '.join(names)
print fullname.encode(default_encoding), \
- (u"(%s: %d)" % (_('books'), author.count)).encode(default_encoding)
+ (u"(%s: %d)" % (_('books'), author.count))\
+ .encode(default_encoding),
+ if args.details >= 1:
+ print "(id=%d)" % author.id,
+ print
def _search_books(case_sensitive, search_type, args):
for book in search_books(search_type, case_sensitive, values,
join_expressions,
orderBy=('series', 'ser_no', 'title')):
- print book.title.encode(default_encoding)
+ print book.title.encode(default_encoding),
+ if args.details >= 1:
+ print "(id=%d)" % book.id,
+ print
if args.details >= 1:
print " ", _("Author(s)"), ":",
for author in book.authors:
for ext in search_extensions(search_type, case_sensitive, values,
orderBy='name'):
print ext.name.encode(default_encoding), \
- (u"(%s: %d)" % (_('books'), ext.count)).encode(default_encoding)
+ (u"(%s: %d)" % (_('books'), ext.count)).encode(default_encoding),
+ if args.details >= 1:
+ print "(id=%d)" % ext.id,
+ print
def _search_genres(case_sensitive, search_type, args):
names = filter(None, (genre.name, genre.title))
fullname = u' '.join(names)
print fullname.encode(default_encoding), \
- (u"(%s: %d)" % (_('books'), genre.count)).encode(default_encoding)
+ (u"(%s: %d)" % (_('books'), genre.count)).encode(default_encoding),
+ if args.details >= 1:
+ print "(id=%d)" % genre.id,
+ print
def _search_languages(case_sensitive, search_type, args):
for lang in search_languages(search_type, case_sensitive, values,
orderBy='name'):
print lang.name.encode(default_encoding), \
- (u"(%s: %d)" % (_('books'), lang.count)).encode(default_encoding)
+ (u"(%s: %d)" % (_('books'), lang.count)).encode(default_encoding),
+ if args.details >= 1:
+ print "(id=%d)" % lang.id,
+ print
if __name__ == '__main__':