mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Fix #2003906 [Auto-add with duplicate detection messes with FileTypePlugins](https://bugs.launchpad.net/calibre/+bug/2003906)
This commit is contained in:
parent
5cc00e504a
commit
33b7c80e29
@ -233,6 +233,7 @@ class AutoAdder(QObject):
|
|||||||
if os.path.exists(fpath):
|
if os.path.exists(fpath):
|
||||||
with open(fpath) as f:
|
with open(fpath) as f:
|
||||||
paths[0] = f.read()
|
paths[0] = f.read()
|
||||||
|
book_fmt = os.path.splitext(os.path.basename(paths[0]))[1][1:].upper()
|
||||||
sz = os.path.join(tdir, 'size.txt')
|
sz = os.path.join(tdir, 'size.txt')
|
||||||
try:
|
try:
|
||||||
with open(sz, 'rb') as f:
|
with open(sz, 'rb') as f:
|
||||||
@ -265,10 +266,7 @@ class AutoAdder(QObject):
|
|||||||
mi.authors = new_authors
|
mi.authors = new_authors
|
||||||
mi.author_sort = gui.current_db.new_api.author_sort_from_authors(mi.authors)
|
mi.author_sort = gui.current_db.new_api.author_sort_from_authors(mi.authors)
|
||||||
mi = [mi]
|
mi = [mi]
|
||||||
dups, ids = m.add_books(paths,
|
dups, ids = m.add_books(paths, [book_fmt], mi, add_duplicates=not gprefs['auto_add_check_for_duplicates'], return_ids=True)
|
||||||
[os.path.splitext(fname)[1][1:].upper()], mi,
|
|
||||||
add_duplicates=not gprefs['auto_add_check_for_duplicates'],
|
|
||||||
return_ids=True)
|
|
||||||
added_ids |= set(ids)
|
added_ids |= set(ids)
|
||||||
num = len(ids)
|
num = len(ids)
|
||||||
if dups:
|
if dups:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user