mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix importing from archives
This commit is contained in:
parent
228c5d7af0
commit
99d36ca88a
@ -43,7 +43,7 @@ def validate_source(source, parent=None): # {{{
|
|||||||
error_dialog(parent, _('Cannot add books'), _(
|
error_dialog(parent, _('Cannot add books'), _(
|
||||||
'You do not have permission to read %s') % source, show=True)
|
'You do not have permission to read %s') % source, show=True)
|
||||||
return False
|
return False
|
||||||
if not source.lower().rpartition(os.extsep) in {'zip', 'rar'}:
|
if not source.lower().rpartition(os.extsep)[-1] in {'zip', 'rar'}:
|
||||||
error_dialog(parent, _('Cannot add books'), _(
|
error_dialog(parent, _('Cannot add books'), _(
|
||||||
'The file %s is not a recognized archive format') % source, show=True)
|
'The file %s is not a recognized archive format') % source, show=True)
|
||||||
return False
|
return False
|
||||||
@ -57,7 +57,7 @@ class Adder(QObject):
|
|||||||
|
|
||||||
def __init__(self, source, single_book_per_directory=True, db=None, parent=None, callback=None, pool=None):
|
def __init__(self, source, single_book_per_directory=True, db=None, parent=None, callback=None, pool=None):
|
||||||
if not validate_source(source, parent):
|
if not validate_source(source, parent):
|
||||||
raise ValueError('Bad source')
|
return
|
||||||
QObject.__init__(self, parent)
|
QObject.__init__(self, parent)
|
||||||
self.single_book_per_directory = single_book_per_directory
|
self.single_book_per_directory = single_book_per_directory
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
@ -381,7 +381,6 @@ class Adder(QObject):
|
|||||||
|
|
||||||
# TODO: Duplicates and auto-merge (in particular adding duplicated files as well as adding files already in the db)
|
# TODO: Duplicates and auto-merge (in particular adding duplicated files as well as adding files already in the db)
|
||||||
# TODO: Test importing with filetype plugin (archive, de-obfuscate)
|
# TODO: Test importing with filetype plugin (archive, de-obfuscate)
|
||||||
# TODO: Test recursive adding when no books are found
|
|
||||||
# TODO: Test handling of exception in metadata read function
|
# TODO: Test handling of exception in metadata read function
|
||||||
# TODO: Report terminal erros where some books have been added better
|
# TODO: Report terminal erros where some books have been added better
|
||||||
# TODO: Test direct add of books to device
|
# TODO: Test direct add of books to device
|
||||||
|
Loading…
x
Reference in New Issue
Block a user