Allow passing multiple filenames as command line arguments to calibre to add multiple books. Fixes #907968 (Right click open with)

This commit is contained in:
Kovid Goyal 2011-12-23 08:31:03 +05:30
parent 146e4812b4
commit f33ed84cd3

View File

@ -143,12 +143,11 @@ class GuiRunner(QObject):
add_filesystem_book = partial(main.iactions['Add Books'].add_filesystem_book, allow_device=False)
sys.excepthook = main.unhandled_exception
if len(self.args) > 1:
p = os.path.abspath(self.args[1])
if os.path.isdir(p):
prints('Ignoring directory passed as command line argument:',
self.args[1])
else:
add_filesystem_book(p)
files = [os.path.abspath(p) for p in self.args[1:] if not
os.path.isdir(p)]
if len(files) < len(sys.argv[1:]):
prints('Ignoring directories passed as command line arguments')
add_filesystem_book(files)
self.app.file_event_hook = add_filesystem_book
self.main = main