Bulk trim newdb

Widget + newdb modifications
This commit is contained in:
sengian 2013-08-11 20:46:55 +02:00
parent ee1142105b
commit 989e6de907
2 changed files with 19 additions and 0 deletions

View File

@ -204,6 +204,16 @@ class MyBlockingBusyNew(QDialog): # {{{
covers.sort(key=lambda x: x[1]) covers.sort(key=lambda x: x[1])
if covers: if covers:
cache.set_cover({book_id:covers[-1][0]}) cache.set_cover({book_id:covers[-1][0]})
elif args.cover_action == 'trim':
from calibre.utils.magick import Image
for book_id in self.ids:
cdata = cache.cover(book_id)
if cdata:
im = Image()
im.load(cdata)
im.trim(10)
cdata = im.export('png')
cache.set_cover({book_id:cdata})
# Formats # Formats
if args.do_remove_format: if args.do_remove_format:
@ -1213,6 +1223,8 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
cover_action = 'generate' cover_action = 'generate'
elif self.cover_from_fmt.isChecked(): elif self.cover_from_fmt.isChecked():
cover_action = 'fromfmt' cover_action = 'fromfmt'
elif self.cover_trim.isChecked():
cover_action = 'trim'
args = Settings(remove_all, remove, add, au, aus, do_aus, rating, pub, do_series, args = Settings(remove_all, remove, add, au, aus, do_aus, rating, pub, do_series,
do_autonumber, do_remove_format, remove_format, do_swap_ta, do_autonumber, do_remove_format, remove_format, do_swap_ta,

View File

@ -603,6 +603,13 @@ Future conversion of these books will use the default settings.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QRadioButton" name="cover_trim">
<property name="text">
<string>&amp;Trim cover</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QRadioButton" name="cover_from_fmt"> <widget class="QRadioButton" name="cover_from_fmt">
<property name="text"> <property name="text">