From 16cadc2a31c39258cd2856e39d97877af2e5bd44 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 6 Aug 2009 14:32:51 -0600 Subject: [PATCH] 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. --- src/calibre/ebooks/conversion/cli.py | 3 ++- src/calibre/utils/poppler/__init__.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index 53eb9582b1..058ed49130 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -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) diff --git a/src/calibre/utils/poppler/__init__.py b/src/calibre/utils/poppler/__init__.py index c35216e081..5c44a99d8b 100644 --- a/src/calibre/utils/poppler/__init__.py +++ b/src/calibre/utils/poppler/__init__.py @@ -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