From: Oleg Broytman Date: Sat, 11 Jun 2016 00:19:34 +0000 (+0300) Subject: Change options: -D|--database, -P|--path, -F|--format X-Git-Tag: 0.0.13~2 X-Git-Url: https://git.phdru.name/?p=m_librarian.git;a=commitdiff_plain;h=486c6f02b0a7dfb9debe00780257d191eb21c395 Change options: -D|--database, -P|--path, -F|--format --- diff --git a/docs-ru/command_line.rst b/docs-ru/command_line.rst index 84e12a0..cbaad64 100644 --- a/docs-ru/command_line.rst +++ b/docs-ru/command_line.rst @@ -13,11 +13,11 @@ ml-initdb.py Использование:: - ml-initdb.py [-d] + ml-initdb.py [-D] Опции:: - -d, --database database Использовать указанную БД + -D, --database database Использовать указанную БД Инициализирует базу данных и импортирует список жанров. Этот скрипт не очень-то нужен, так как следующий скрипт делает всё указанное. @@ -28,11 +28,11 @@ ml-import.py Использование:: - ml-import.py [-d] [file.inpx ...] + ml-import.py [-D] [file.inpx ...] Опции:: - -d, --database database Использовать указанную БД + -D, --database database Использовать указанную БД Инициализирует базу данных, импортирует список жанров и список файлов INPX, перечисленных в командной строке. При повторных запусках не @@ -45,14 +45,14 @@ ml-search.py Использование:: - ml-search.py [-d] [-i] [-I] [-t] [-s] [-f] [-v] [-c] ... + ml-search.py [-D] [-i] [-I] [-t] [-s] [-f] [-v] [-c] ... Программа выполняет поиск по базе данных и показывает список результатов. В настоящее время может искать только в списке авторов. Глобальные опции:: - -d, --database database Использовать указанную БД + -D, --database database Использовать указанную БД -i, --ignore-case независимо от регистра (по умолчанию: угадать) -I, --case-sensitive с учётом регистра -t, --start тип поиска: подстрока в начале строки @@ -122,7 +122,7 @@ ml-search.py Использование:: - ml-search.py books [-t title] [-s series] [-a archive] [-f file] [-p path] [--format f] [--get] [--get-many N] [--id id] [--surname name] [--name name] [--misc-name name] [--fullname name] [--aid aid] [-e ext] [--eid eid] [--gname name] [--gtitle title] [--gid gid] [-l lang] [--lid lid] + ml-search.py books [-t title] [-s series] [-a archive] [-f file] [--id id] [--surname name] [--name name] [--misc-name name] [--fullname name] [--aid aid] [-e ext] [--eid eid] [--gname name] [--gtitle title] [--gid gid] [-l lang] [--lid lid] [-P path] [-F format] [--get] [--get-many N] Искать и печатать список книг по заголовку, серии, архиву, имени файла. @@ -132,10 +132,6 @@ ml-search.py -s, --series серия Искать по серии -a, --archive архив Искать по имени архива (zip-файла) -f, --file файл Искать по имени файла (без расширения) - -p, --path path Путь к директории с архивами библиотеки - --format format Формат имени сохраняемого файла - --get Загрузить ровно один файл - --get-many N Загрузить не больше указанного числа файлов --id id Искать по id книги --surname surname Искать по фамилии автора --name name Искать по имени автора @@ -149,6 +145,10 @@ ml-search.py --gid gid Искать по id жанра -l, --lang lang Искать по языку --lid lid Искать по id языка + -P, --path path Путь к директории с архивами библиотеки + -F, --format format Формат имени сохраняемого файла + --get Загрузить ровно один файл + --get-many N Загрузить не больше указанного числа файлов По умолчанию программы выводит список заголовков найденных книг. При использовании опции `-v` также выводится id из БД, список авторов и @@ -158,7 +158,7 @@ ml-search.py выводятся имя архива, имя файла, расширение и размер файла, и признак, была ли книга помечена как удалённая. -Опция `-p` задаёт путь к директории с архивами библиотеки. По умолчанию +Опция `-P` задаёт путь к директории с архивами библиотеки. По умолчанию этот путь берётся из файла конфигурации `m_librarian`, секция `[library]`, ключ `path`, например:: @@ -166,7 +166,7 @@ ml-search.py path = /var/lib/archives Опция полезна в ситуации работы с несколькими базами данных (глобальная -опция `-d`). +опция `-D`). Опция `--get` позволяет загрузить книгу из библиотеки в файл. Опция позволяет загрузить ровно одну книгу, поэтому самый простой способ @@ -197,7 +197,7 @@ ml-search.py в конец с точкой в качестве разделителя. Т.о. формат `%f` эквивалентен формату `%f.%e`. -Опция `--format format` позволяет указать формат в командной строке. +Опция `-F|--format format` позволяет указать формат в командной строке. Опция `--get-many N` позволяет загрузить указанное число книг (не больше чем N, где N — целое число.) Опции `--get-many N` и `--get` взаимно diff --git a/docs/command_line.rst b/docs/command_line.rst index d91c3f5..99b5c84 100644 --- a/docs/command_line.rst +++ b/docs/command_line.rst @@ -13,11 +13,11 @@ ml-initdb.py Usage:: - ml-initdb.py [-d] + ml-initdb.py [-D] Options:: - -d, --database database Open this database by pathname/db uri + -D, --database database Open this database by pathname/db uri Initialize database and import genres list. Isn’t really needed as the next script does all that too. @@ -28,11 +28,11 @@ ml-import.py Usage:: - ml-import.py [-d] [file.inpx ...] + ml-import.py [-D] [file.inpx ...] Options:: - -d, --database database Open this database by pathname/db uri + -D, --database database Open this database by pathname/db uri Initialize database, import genres list and import a list of INPX files listed in the command line. On subsequent runs doesn’t destroy DB or @@ -44,14 +44,14 @@ ml-search.py Usage:: - ml-search.py [-d] [-i] [-I] [-t] [-s] [-f] [-v] [-c] ... + ml-search.py [-D] [-i] [-I] [-t] [-s] [-f] [-v] [-c] ... Search through the database and display results. Currently can only search authors by name. Global options:: - -d, --database database Open this database by pathname/db uri + -D, --database database Open this database by pathname/db uri -i, --ignore-case ignore case (default is to guess) -I, --case-sensitive don’t ignore case -t, --start search type: substring at the start @@ -119,7 +119,7 @@ Book searching and downloading Usage:: - ml-search.py books [-t title] [-s series] [-a archive] [-f file] [-p path] [--format f] [--get] [--get-many N] [--id id] [--surname name] [--name name] [--misc-name name] [--fullname name] [--aid aid] [-e ext] [--eid eid] [--gname name] [--gtitle title] [--gid gid] [-l lang] [--lid lid] + ml-search.py books [-t title] [-s series] [-a archive] [-f file] [--id id] [--surname name] [--name name] [--misc-name name] [--fullname name] [--aid aid] [-e ext] [--eid eid] [--gname name] [--gtitle title] [--gid gid] [-l lang] [--lid lid] [-P path] [-F format] [--get] [--get-many N] Search and print a list of books by title, series, archive or file name. @@ -129,11 +129,6 @@ Options:: -s, --series series Search by series -a, --archive archive Search by archive (zip file) -f, --file file Search by file name (without extension) - -p, --path path Path to the directory with the library - archives - --format format Format of the downloaded file name - --get Download exactly one book - --get-many N Download at most this many books --id id Search by database id --surname surname Search by author’s surname --name name Search by author’s name @@ -147,6 +142,11 @@ Options:: --gid gid Search by genre’s id -l, --lang lang Search by language --lid lid Search by language’s id + -P, --path path Path to the directory with the library + archives + -F, --format format Format of the downloaded file name + --get Download exactly one book + --get-many N Download at most this many books By default the program prints only titles of the found book. With one option `-v` it also prints database id, the list of authors and genres, @@ -156,14 +156,14 @@ it also prints the file date and language. With three `-v` it prints archive name, file name, extension and size, and flag if the book is marked to be deleted. -Option `-p` provides the path to the directory with the library +Option `-P` provides the path to the directory with the library archives. By default the path is extracted from `m_librarian.conf`, section `[library]`, key `path`:: [library] path = /var/lib/archives -The option is useful for multiple databases (global option `-d`). +The option is useful for multiple databases (global option `-D`). Option `--get` allows to download a book from the library to a local file. The option allows to download exactly one book. The simplest way @@ -193,7 +193,7 @@ Format must not end in directory separator (`/` or `\\`). If specifier unconditionally with a dot. That is, format `%f` is equivalent to `%f.%e`. -Option `--format format` allows to overwrite this configuration value. +Option `-F|--format format` allows to overwrite this configuration value. Option `--get-many N` allows to download many books (at most N, where N is an integer). Options `--get-many N` and `--get` are, of course, diff --git a/scripts/ml-import.py b/scripts/ml-import.py index 066c5cc..f154841 100755 --- a/scripts/ml-import.py +++ b/scripts/ml-import.py @@ -7,7 +7,7 @@ from m_librarian.inp import import_inpx if __name__ == '__main__': parser = argparse.ArgumentParser(description='Import') - parser.add_argument('-d', '--database', help='database URI') + parser.add_argument('-D', '--database', help='database URI') parser.add_argument('inpx', nargs='+', help='INPX files to import') args = parser.parse_args() diff --git a/scripts/ml-initdb.py b/scripts/ml-initdb.py index 4dc71b5..f46b7c2 100755 --- a/scripts/ml-initdb.py +++ b/scripts/ml-initdb.py @@ -6,7 +6,7 @@ from m_librarian.glst import import_glst if __name__ == '__main__': parser = argparse.ArgumentParser(description='Init') - parser.add_argument('-d', '--database', help='database URI') + parser.add_argument('-D', '--database', help='database URI') args = parser.parse_args() open_db(args.database) diff --git a/scripts/ml-search.py b/scripts/ml-search.py index a6fe3e5..0742a53 100755 --- a/scripts/ml-search.py +++ b/scripts/ml-search.py @@ -261,7 +261,7 @@ def _search_languages(case_sensitive, search_type, args): if __name__ == '__main__': main_parser = argparse.ArgumentParser(description='Search') - main_parser.add_argument('-d', '--database', help='database URI') + main_parser.add_argument('-D', '--database', help='database URI') main_parser.add_argument('-i', '--ignore-case', action='store_true', help='ignore case ' '(default is to guess)') @@ -294,12 +294,6 @@ 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('-p', '--path', help='path to the library archives') - parser.add_argument('--format', help='download format, default is %f') - parser.add_argument('--get', action='store_true', - help='download exactly one book') - parser.add_argument('--get-many', type=int, - help='download at most this many books') parser.add_argument('--id', type=int, help='search by database id') parser.add_argument('--surname', help='search by author\'s surname') parser.add_argument('--name', help='search by author\'s name') @@ -313,6 +307,13 @@ if __name__ == '__main__': parser.add_argument('--gid', type=int, help='search by genre\'s id') parser.add_argument('-l', '--lang', help='search by language') parser.add_argument('--lid', type=int, help='search by language\'s id') + parser.add_argument('-P', '--path', help='path to the library archives') + parser.add_argument('-F', '--format', + help='download format, default is %f') + parser.add_argument('--get', action='store_true', + help='download exactly one book') + parser.add_argument('--get-many', type=int, + help='download at most this many books') parser.set_defaults(func=_search_books) parser = subparsers.add_parser('ext', help='Search extensions')