mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Allow removal of tags in bulk metadata dialog
This commit is contained in:
parent
22e0bd2b91
commit
f5c1140042
@ -65,6 +65,10 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
||||
if tags:
|
||||
tags = tags.split(',')
|
||||
self.db.set_tags(id, tags, append=True)
|
||||
remove_tags = qstring_to_unicode(self.remove_tags.text()).strip()
|
||||
if remove_tags:
|
||||
remove_tags = [i.strip() for i in remove_tags.split(',')]
|
||||
self.db.unapply_tags(id, remove_tags)
|
||||
if self.write_series:
|
||||
self.db.set_series(id, qstring_to_unicode(self.series.currentText()))
|
||||
self.changed = True
|
||||
|
@ -6,7 +6,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>461</width>
|
||||
<height>342</height>
|
||||
<height>387</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
@ -154,6 +154,23 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>&Remove tags:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>remove_tags</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" >
|
||||
<widget class="QLineEdit" name="remove_tags" >
|
||||
<property name="toolTip" >
|
||||
<string>Comma separated list of tags to remove from the books. </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string>&Series:</string>
|
||||
@ -169,7 +186,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" >
|
||||
<item row="6" column="1" >
|
||||
<widget class="QComboBox" name="series" >
|
||||
<property name="toolTip" >
|
||||
<string>List of known series. You can add new series.</string>
|
||||
|
@ -1085,6 +1085,13 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
||||
for tag in tags:
|
||||
self.delete_tag(tag)
|
||||
|
||||
def unapply_tags(self, book_id, tags):
|
||||
for tag in tags:
|
||||
id = self.conn.execute('SELECT id FROM tags WHERE name=?', (tag,)).fetchone()
|
||||
if id:
|
||||
self.conn.execute('DELETE FROM books_tags_link WHERE tag=? AND book=?', (id[0], book_id))
|
||||
self.conn.commit()
|
||||
|
||||
def set_tags(self, id, tags, append=False):
|
||||
'''
|
||||
@param tags: list of strings
|
||||
|
Loading…
x
Reference in New Issue
Block a user