Add 'delete other formats' option, bump to 1.0.3.

This commit is contained in:
Jim Miller
2011-12-30 14:24:30 -06:00
parent 81e6134139
commit 4ac42526bd
3 changed files with 14 additions and 17 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ class InterfacePluginDemo(InterfaceActionBase):
description = 'UI plugin to download FanFiction stories from various sites.'
supported_platforms = ['windows', 'osx', 'linux']
author = 'Jim Miller'
version = (1, 0, 2)
version = (1, 0, 3)
minimum_calibre_version = (0, 8, 30)
# action_menu_clone_qaction = True
+7
View File
@@ -34,6 +34,7 @@ prefs.defaults['urlsfromselected'] = True
prefs.defaults['urlsfrompriority'] = SELECTED
prefs.defaults['fileform'] = 'epub'
prefs.defaults['collision'] = OVERWRITE
prefs.defaults['deleteotherforms'] = False
class ConfigWidget(QWidget):
@@ -105,6 +106,11 @@ class ConfigWidget(QWidget):
horz.addWidget(self.urlsfrompriority)
self.l.addLayout(horz)
self.deleteotherforms = QCheckBox('Delete other existing formats?',self)
self.deleteotherforms.setToolTip('Check this to automatically delete all other ebook formats when updating an existing book.\nHandy if you have both a Nook(epub) and Kindle(mobi), for example.')
self.deleteotherforms.setChecked(prefs['deleteotherforms'])
self.l.addWidget(self.deleteotherforms)
self.label = QLabel('personal.ini:')
self.l.addWidget(self.label)
@@ -121,6 +127,7 @@ class ConfigWidget(QWidget):
prefs['urlsfromclip'] = self.urlsfromclip.isChecked()
prefs['urlsfromselected'] = self.urlsfromselected.isChecked()
prefs['onlyoverwriteifnewer'] = self.onlyoverwriteifnewer.isChecked()
prefs['deleteotherforms'] = self.deleteotherforms.isChecked()
ini = unicode(self.ini.toPlainText())
if ini:
+6 -16
View File
@@ -437,22 +437,12 @@ class FanFictionDownLoaderPlugin(InterfaceAction):
db.add_format_with_hooks(book_id, fileform, tmp, index_is_id=True)
# get all formats.
# fmts = set([x.lower() for x in db.formats(book_id, index_is_id=True).split(',')])
# for fmt in fmts:
# if fmt != fileform:
# print("f:"+fmt)
# ## calling convert doesn't work here because we're in a BG thread.
# # (jobs,changed,bad)=convert_single_ebook(self.gui,
# # db,
# # [book_id],
# # auto_conversion=True,
# # out_format=fmt)
# # print("jobs:%s changed:%s bad:%s"%(jobs,changed,bad))
# db.remove_format(book_id, fmt,index_is_id=True)#, notify=False
# for a in self.gui.iactions: # ['Convert Books']
# print("a:%s"%a)
if prefs['deleteotherforms']:
fmts = set([x.lower() for x in db.formats(book_id, index_is_id=True).split(',')])
for fmt in fmts:
if fmt != fileform:
print("remove f:"+fmt)
db.remove_format(book_id, fmt,index_is_id=True)#, notify=False
if updatemeta or collision == CALIBREONLY:
db.set_metadata(book_id,mi)