Использование::
- ml-search.py [-i/-I] [-t/-s/-f] author [-s surname] [-n name] [-m misc-name] [fullname]
+ ml-search.py [-i/-I] [-t/-s/-f] author [-s surname] [-n name] [-m misc-name] [--id id] [fullname]
Искать и печатать список авторов по фамилии, имени, доп. имени (обычно
отчеству) или полному имени.
-s, --surname фамилия Искать по фамилии
-n, --name имя Искать по имени
-m, --misc-name доп. имени Искать по доп. имени
+ --id id Искать по id автора
Пример::
Использование::
- ml-search.py [-i/-I] [-t/-s/-f] ext [name]
+ ml-search.py [-i/-I] [-t/-s/-f] ext [name] [--id id]
+
+Опции::
+
+ --id id Искать по id расширения
Искать и печатать список расширений имён файлов по имени.
Использование::
- ml-search.py [-i/-I] [-t/-s/-f] genres [-n name] [-t title]
+ ml-search.py [-i/-I] [-t/-s/-f] genres [-n name] [-t title] [--id id]
Искать и печатать список жанров по имени и заголовку.
-n, --name имя Искать по названию
-t, --title заголовок Искать по заголовку
+ --id id Искать по id жанра
При использовании опции `-d` также выводится id из БД.
Использование::
- ml-search.py [-i/-I] [-t/-s/-f] lang [name]
+ ml-search.py [-i/-I] [-t/-s/-f] lang [name] [--id id]
+
+Опции::
+
+ --id id Искать по id языка
Искать и печатать список языков по имени.
Usage::
- ml-search.py [-i/-I] [-t/-s/-f] author [-s surname] [-n name] [-m misc-name] [fullname]
+ ml-search.py [-i/-I] [-t/-s/-f] author [-s surname] [-n name] [-m misc-name] [--id id] [fullname]
Search and print a list of authors by surname/name/misc name/full name.
-s, --surname surname Search by surname
-n, --name name Search by name
-m, --misc-name misc. name Search by misc. name
+ --id id Search by database id
Example::
Usage::
- ml-search.py [-i/-I] [-t/-s/-f] ext [name]
+ ml-search.py [-i/-I] [-t/-s/-f] ext [name] [--id id]
+
+Options::
+
+ --id id Search by database id
Search and print a list of extensions by name.
Usage::
- ml-search.py [-i/-I] [-t/-s/-f] genres [-n name] [-t title]
+ ml-search.py [-i/-I] [-t/-s/-f] genres [-n name] [-t title] [--id id]
Search and print a list of genres by name and title.
-n, --name name Search by name
-t, --title title Search by title
+ --id id Search by database id
With one option `-d` it also prints database id.
Usage::
- ml-search.py [-i/-I] [-t/-s/-f] lang [name]
+ ml-search.py [-i/-I] [-t/-s/-f] lang [name] [--id id]
Search and print a list of languages by name.
+Options::
+
+ --id id Search by database id
+
With one option `-d` it also prints database id.
.. vim: set tw=72 :
main_parser.print_help()
sys.exit(1)
expressions = []
- values = _get_values(args, 'surname', 'name', 'misc_name')
+ values = _get_values(args, 'surname', 'name', 'misc_name', 'id')
if not values:
value = args.fullname
if value:
def _search_extensions(case_sensitive, search_type, args):
- if args.name:
- values = {'name': args.name}
- if case_sensitive is None:
- case_sensitive = _guess_case_sensitivity(values)
+ values = _get_values(args, 'name', 'id')
+ if case_sensitive is None:
+ case_sensitive = _guess_case_sensitivity(values)
else:
values = {}
extensions = search_extensions(search_type, case_sensitive, values,
def _search_genres(case_sensitive, search_type, args):
- values = _get_values(args, 'name', 'title')
+ values = _get_values(args, 'name', 'title', 'id')
if case_sensitive is None:
case_sensitive = _guess_case_sensitivity(values)
genres = search_genres(search_type, case_sensitive, values, orderBy='name')
def _search_languages(case_sensitive, search_type, args):
- if args.name:
- values = {'name': args.name}
- if case_sensitive is None:
- case_sensitive = _guess_case_sensitivity(values)
+ values = _get_values(args, 'name', 'id')
+ if case_sensitive is None:
+ case_sensitive = _guess_case_sensitivity(values)
else:
values = {}
for lang in search_languages(search_type, case_sensitive, values,
parser.add_argument('-s', '--surname', help='search by surname')
parser.add_argument('-n', '--name', help='search by name')
parser.add_argument('-m', '--misc-name', help='search by misc. name')
+ parser.add_argument('--id', help='search by database id')
parser.add_argument('fullname', nargs='?', help='search by full name')
parser.set_defaults(func=_search_authors)
parser = subparsers.add_parser('ext', help='Search extensions')
parser.add_argument('name', nargs='?', help='search by name')
+ parser.add_argument('--id', help='search by database id')
parser.set_defaults(func=_search_extensions)
parser = subparsers.add_parser('genres', help='Search genres')
parser.add_argument('-n', '--name', help='search by name')
parser.add_argument('-t', '--title', help='search by title')
+ parser.add_argument('--id', help='search by database id')
parser.set_defaults(func=_search_genres)
parser = subparsers.add_parser('lang', help='Search languages')
parser.add_argument('name', nargs='?', help='search by name')
+ parser.add_argument('--id', help='search by database id')
parser.set_defaults(func=_search_languages)
args = main_parser.parse_args()