Skip to content

Commit

Permalink
Fix #2003906 [Auto-add with duplicate detection messes with FileTypeP…
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jan 31, 2023
1 parent 5cc00e5 commit 33b7c80
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/calibre/gui2/auto_add.py
Expand Up @@ -233,6 +233,7 @@ def do_add(self, data):
if os.path.exists(fpath):
with open(fpath) as f:
paths[0] = f.read()
book_fmt = os.path.splitext(os.path.basename(paths[0]))[1][1:].upper()
sz = os.path.join(tdir, 'size.txt')
try:
with open(sz, 'rb') as f:
Expand Down Expand Up @@ -265,10 +266,7 @@ def do_add(self, data):
mi.authors = new_authors
mi.author_sort = gui.current_db.new_api.author_sort_from_authors(mi.authors)
mi = [mi]
dups, ids = m.add_books(paths,
[os.path.splitext(fname)[1][1:].upper()], mi,
add_duplicates=not gprefs['auto_add_check_for_duplicates'],
return_ids=True)
dups, ids = m.add_books(paths, [book_fmt], mi, add_duplicates=not gprefs['auto_add_check_for_duplicates'], return_ids=True)
added_ids |= set(ids)
num = len(ids)
if dups:
Expand Down

0 comments on commit 33b7c80

Please sign in to comment.