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:
Kovid Goyal 2014-12-08 09:46:26 +05:30
parent 5023426850
commit e9f1b2f726

View File

@ -132,9 +132,10 @@ class AddAction(InterfaceAction):
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)