mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-20 05:55:27 +01: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
1 changed files with 3 additions and 2 deletions
|
|
@ -132,9 +132,10 @@ def add_formats(self, *args):
|
|||
if not confirm(msg, 'confirm_format_override_on_add', title=_('Are you sure?'), parent=self.gui):
|
||||
return
|
||||
|
||||
fmt_map = {os.path.splitext(fpath)[1][1:].upper():fpath for fpath in books}
|
||||
|
||||
for id_ in ids:
|
||||
for fpath in books:
|
||||
fmt = os.path.splitext(fpath)[1][1:].upper()
|
||||
for fmt, fpath in fmt_map.iteritems():
|
||||
if fmt:
|
||||
db.add_format_with_hooks(id_, fmt, fpath, index_is_id=True,
|
||||
notify=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue