diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index d68c16c559..a78e40fe67 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -67,6 +67,8 @@ def check_command_line_options(parser, args, log): ('-h' in args or '--help' in args): log.error('Cannot read from', input) raise SystemExit(1) + if input.endswith('.recipe') and not os.access(input, os.R_OK): + input = args[1] output = args[2] if (output.startswith('.') and output[:2] not in {'..', '.'} and '/' not in diff --git a/src/calibre/ebooks/conversion/plugins/recipe_input.py b/src/calibre/ebooks/conversion/plugins/recipe_input.py index 9bd4077528..2630ff0c85 100644 --- a/src/calibre/ebooks/conversion/plugins/recipe_input.py +++ b/src/calibre/ebooks/conversion/plugins/recipe_input.py @@ -68,10 +68,15 @@ class RecipeInput(InputFormatPlugin): recipe = compile_recipe(self.recipe_source) log('Using custom recipe') else: - from calibre.web.feeds.recipes.collection import \ - get_builtin_recipe_by_title + from calibre.web.feeds.recipes.collection import ( + get_builtin_recipe_by_title, get_builtin_recipe_titles) title = getattr(opts, 'original_recipe_input_arg', recipe_or_file) title = os.path.basename(title).rpartition('.')[0] + titles = frozenset(get_builtin_recipe_titles()) + if title not in titles: + title = getattr(opts, 'original_recipe_input_arg', recipe_or_file) + title = title.rpartition('.')[0] + raw = get_builtin_recipe_by_title(title, log=log, download_recipe=not opts.dont_download_recipe) builtin = False