PDF metadata: If no metadata available, don't use full path as title. ebook-convert: If --help is specified, don't require the input file to exist.

This commit is contained in:
Kovid Goyal 2009-08-06 14:32:51 -06:00
parent 0df9e9bd9d
commit 16cadc2a31
2 changed files with 3 additions and 2 deletions

View File

@ -57,7 +57,8 @@ def check_command_line_options(parser, args, log):
raise SystemExit(1)
input = os.path.abspath(args[1])
if not input.endswith('.recipe') and not os.access(input, os.R_OK):
if not input.endswith('.recipe') and not os.access(input, os.R_OK) and not \
('-h' in args or '--help' in args):
log.error('Cannot read from', input)
raise SystemExit(1)

View File

@ -26,7 +26,7 @@ def get_metadata(stream, cover=True):
if not title or not title.strip():
title = _('Unknown')
if hasattr(stream, 'name'):
title = os.path.splitext(stream.name)[0]
title = os.path.splitext(os.path.basename(stream.name))[0]
author = doc.author
authors = string_to_authors(author) if author else [_('Unknown')]
creator = doc.creator