mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When doing "Add files to selected books" do not add the same format multiple times when the user selects multiple files of a particular format
This commit is contained in:
parent
5023426850
commit
e9f1b2f726
@ -132,9 +132,10 @@ class AddAction(InterfaceAction):
|
|||||||
if not confirm(msg, 'confirm_format_override_on_add', title=_('Are you sure?'), parent=self.gui):
|
if not confirm(msg, 'confirm_format_override_on_add', title=_('Are you sure?'), parent=self.gui):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
fmt_map = {os.path.splitext(fpath)[1][1:].upper():fpath for fpath in books}
|
||||||
|
|
||||||
for id_ in ids:
|
for id_ in ids:
|
||||||
for fpath in books:
|
for fmt, fpath in fmt_map.iteritems():
|
||||||
fmt = os.path.splitext(fpath)[1][1:].upper()
|
|
||||||
if fmt:
|
if fmt:
|
||||||
db.add_format_with_hooks(id_, fmt, fpath, index_is_id=True,
|
db.add_format_with_hooks(id_, fmt, fpath, index_is_id=True,
|
||||||
notify=True)
|
notify=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user