mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-09 10:23:29 +01:00
Remove 'Update EPUB Cover?' download up, add Cover New Only instead.
This commit is contained in:
parent
f99889d5e8
commit
a1f3349da0
5 changed files with 35 additions and 37 deletions
|
|
@ -278,7 +278,6 @@ class ConfigWidget(QWidget):
|
||||||
prefs['collision'] = save_collisions[unicode(self.basic_tab.collision.currentText())]
|
prefs['collision'] = save_collisions[unicode(self.basic_tab.collision.currentText())]
|
||||||
prefs['updatemeta'] = self.basic_tab.updatemeta.isChecked()
|
prefs['updatemeta'] = self.basic_tab.updatemeta.isChecked()
|
||||||
prefs['bgmeta'] = self.basic_tab.bgmeta.isChecked()
|
prefs['bgmeta'] = self.basic_tab.bgmeta.isChecked()
|
||||||
prefs['updateepubcover'] = self.basic_tab.updateepubcover.isChecked()
|
|
||||||
prefs['keeptags'] = self.basic_tab.keeptags.isChecked()
|
prefs['keeptags'] = self.basic_tab.keeptags.isChecked()
|
||||||
prefs['mark'] = self.basic_tab.mark.isChecked()
|
prefs['mark'] = self.basic_tab.mark.isChecked()
|
||||||
prefs['mark_success'] = self.basic_tab.mark_success.isChecked()
|
prefs['mark_success'] = self.basic_tab.mark_success.isChecked()
|
||||||
|
|
@ -333,6 +332,7 @@ class ConfigWidget(QWidget):
|
||||||
prefs['calibre_gen_cover'] = self.calibrecover_tab.calibre_gen_cover.isChecked()
|
prefs['calibre_gen_cover'] = self.calibrecover_tab.calibre_gen_cover.isChecked()
|
||||||
prefs['plugin_gen_cover'] = self.calibrecover_tab.plugin_gen_cover.isChecked()
|
prefs['plugin_gen_cover'] = self.calibrecover_tab.plugin_gen_cover.isChecked()
|
||||||
prefs['gcnewonly'] = self.calibrecover_tab.gcnewonly.isChecked()
|
prefs['gcnewonly'] = self.calibrecover_tab.gcnewonly.isChecked()
|
||||||
|
prefs['covernewonly'] = self.calibrecover_tab.covernewonly.isChecked()
|
||||||
gc_site_settings = {}
|
gc_site_settings = {}
|
||||||
for (site,combo) in six.iteritems(self.calibrecover_tab.gc_dropdowns):
|
for (site,combo) in six.iteritems(self.calibrecover_tab.gc_dropdowns):
|
||||||
val = unicode(combo.itemData(combo.currentIndex()))
|
val = unicode(combo.itemData(combo.currentIndex()))
|
||||||
|
|
@ -482,11 +482,6 @@ class BasicTab(QWidget):
|
||||||
self.updatemeta.setChecked(prefs['updatemeta'])
|
self.updatemeta.setChecked(prefs['updatemeta'])
|
||||||
horz.addWidget(self.updatemeta)
|
horz.addWidget(self.updatemeta)
|
||||||
|
|
||||||
self.updateepubcover = QCheckBox(_('Default Update EPUB Cover when Updating EPUB?'),self)
|
|
||||||
self.updateepubcover.setToolTip(_("On each download, FanFicFare offers an option to update the book cover image <i>inside</i> the EPUB from the web site when the EPUB is updated.<br />This sets whether that will default to on or off."))
|
|
||||||
self.updateepubcover.setChecked(prefs['updateepubcover'])
|
|
||||||
horz.addWidget(self.updateepubcover)
|
|
||||||
|
|
||||||
self.bgmeta = QCheckBox(_('Default Background Metadata?'),self)
|
self.bgmeta = QCheckBox(_('Default Background Metadata?'),self)
|
||||||
self.bgmeta.setToolTip(_("On each download, FanFicFare offers an option to Collect Metadata from sites in a Background process.<br />This returns control to you quicker while updating, but you won't be asked for username/passwords or if you are an adult--stories that need those will just fail.<br />Only available for Update/Overwrite of existing books in case URL given isn't canonical or matches to existing book by Title/Author."))
|
self.bgmeta.setToolTip(_("On each download, FanFicFare offers an option to Collect Metadata from sites in a Background process.<br />This returns control to you quicker while updating, but you won't be asked for username/passwords or if you are an adult--stories that need those will just fail.<br />Only available for Update/Overwrite of existing books in case URL given isn't canonical or matches to existing book by Title/Author."))
|
||||||
self.bgmeta.setChecked(prefs['bgmeta'])
|
self.bgmeta.setChecked(prefs['bgmeta'])
|
||||||
|
|
@ -997,7 +992,7 @@ class CalibreCoverTab(QWidget):
|
||||||
|
|
||||||
self.gencov_elements=[] ## used to disable/enable when gen
|
self.gencov_elements=[] ## used to disable/enable when gen
|
||||||
## cover is off/on. This is more
|
## cover is off/on. This is more
|
||||||
## about being a visual que than real
|
## about being a visual cue than real
|
||||||
## necessary function.
|
## necessary function.
|
||||||
|
|
||||||
topl = self.l = QVBoxLayout()
|
topl = self.l = QVBoxLayout()
|
||||||
|
|
@ -1018,6 +1013,12 @@ class CalibreCoverTab(QWidget):
|
||||||
self.l.addWidget(label)
|
self.l.addWidget(label)
|
||||||
self.l.addSpacing(5)
|
self.l.addSpacing(5)
|
||||||
|
|
||||||
|
self.covernewonly = QCheckBox(_("Set Covers Only for New Books"),self)
|
||||||
|
self.covernewonly.setToolTip(_("Set or generate a Calibre cover only for new books, never for updated books."))
|
||||||
|
self.covernewonly.setChecked(prefs['covernewonly'])
|
||||||
|
self.l.addWidget(self.covernewonly)
|
||||||
|
self.l.addSpacing(5)
|
||||||
|
|
||||||
tooltip = _("Update Calibre book cover image from EPUB when Calibre metadata is updated.\n"
|
tooltip = _("Update Calibre book cover image from EPUB when Calibre metadata is updated.\n"
|
||||||
"Doesn't go looking for new images on 'Update Calibre Metadata Only'.\n"
|
"Doesn't go looking for new images on 'Update Calibre Metadata Only'.\n"
|
||||||
"Cover in EPUB could be from site or previously injected into the EPUB.\n"
|
"Cover in EPUB could be from site or previously injected into the EPUB.\n"
|
||||||
|
|
|
||||||
|
|
@ -314,12 +314,6 @@ class AddNewDialog(SizePersistedDialog):
|
||||||
self.mergehide.append(self.updatemeta)
|
self.mergehide.append(self.updatemeta)
|
||||||
self.mergeupdateshow.append(self.updatemeta)
|
self.mergeupdateshow.append(self.updatemeta)
|
||||||
|
|
||||||
self.updateepubcover = QCheckBox(_('Update EPUB Cover?'),self)
|
|
||||||
self.updateepubcover.setToolTip(_('Update book cover image from site or defaults (if found) <i>inside</i> the EPUB when EPUB is updated.'))
|
|
||||||
self.updateepubcover.setChecked(self.prefs['updateepubcover'])
|
|
||||||
horz.addWidget(self.updateepubcover)
|
|
||||||
self.mergehide.append(self.updateepubcover)
|
|
||||||
|
|
||||||
self.gbl.addLayout(horz)
|
self.gbl.addLayout(horz)
|
||||||
|
|
||||||
## bgmeta not used with Add New because of stories that change
|
## bgmeta not used with Add New because of stories that change
|
||||||
|
|
@ -449,9 +443,6 @@ class AddNewDialog(SizePersistedDialog):
|
||||||
self.updatemeta.setChecked(self.prefs['updatemeta'])
|
self.updatemeta.setChecked(self.prefs['updatemeta'])
|
||||||
# self.bgmeta.setChecked(self.prefs['bgmeta'])
|
# self.bgmeta.setChecked(self.prefs['bgmeta'])
|
||||||
|
|
||||||
if not self.merge:
|
|
||||||
self.updateepubcover.setChecked(self.prefs['updateepubcover'])
|
|
||||||
|
|
||||||
self.url.setText(url_list_text)
|
self.url.setText(url_list_text)
|
||||||
if url_list_text:
|
if url_list_text:
|
||||||
self.button_box.button(QDialogButtonBox.Ok).setFocus()
|
self.button_box.button(QDialogButtonBox.Ok).setFocus()
|
||||||
|
|
@ -489,14 +480,12 @@ class AddNewDialog(SizePersistedDialog):
|
||||||
'collision': unicode(self.collision.currentText()),
|
'collision': unicode(self.collision.currentText()),
|
||||||
'updatemeta': self.updatemeta.isChecked(),
|
'updatemeta': self.updatemeta.isChecked(),
|
||||||
'bgmeta': False, # self.bgmeta.isChecked(),
|
'bgmeta': False, # self.bgmeta.isChecked(),
|
||||||
'updateepubcover': self.updateepubcover.isChecked(),
|
|
||||||
'smarten_punctuation':self.prefs['smarten_punctuation'],
|
'smarten_punctuation':self.prefs['smarten_punctuation'],
|
||||||
'do_wordcount':self.prefs['do_wordcount'],
|
'do_wordcount':self.prefs['do_wordcount'],
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.merge:
|
if self.merge:
|
||||||
retval['fileform']=='epub'
|
retval['fileform']=='epub'
|
||||||
retval['updateepubcover']=True
|
|
||||||
if self.newmerge:
|
if self.newmerge:
|
||||||
retval['updatemeta']=True
|
retval['updatemeta']=True
|
||||||
retval['collision']=ADDNEW
|
retval['collision']=ADDNEW
|
||||||
|
|
@ -891,11 +880,6 @@ class UpdateExistingDialog(SizePersistedDialog):
|
||||||
self.updatemeta.setChecked(self.prefs['updatemeta'])
|
self.updatemeta.setChecked(self.prefs['updatemeta'])
|
||||||
horz.addWidget(self.updatemeta)
|
horz.addWidget(self.updatemeta)
|
||||||
|
|
||||||
self.updateepubcover = QCheckBox(_('Update EPUB Cover?'),self)
|
|
||||||
self.updateepubcover.setToolTip(_('Update book cover image from site or defaults (if found) <i>inside</i> the EPUB when EPUB is updated.'))
|
|
||||||
self.updateepubcover.setChecked(self.prefs['updateepubcover'])
|
|
||||||
horz.addWidget(self.updateepubcover)
|
|
||||||
|
|
||||||
self.bgmeta = QCheckBox(_('Background Metadata?'),self)
|
self.bgmeta = QCheckBox(_('Background Metadata?'),self)
|
||||||
self.bgmeta.setToolTip(_("Collect Metadata from sites in a Background process.<br />This returns control to you quicker while updating, but you won't be asked for username/passwords or if you are an adult--stories that need those will just fail."))
|
self.bgmeta.setToolTip(_("Collect Metadata from sites in a Background process.<br />This returns control to you quicker while updating, but you won't be asked for username/passwords or if you are an adult--stories that need those will just fail."))
|
||||||
self.bgmeta.setChecked(self.prefs['bgmeta'])
|
self.bgmeta.setChecked(self.prefs['bgmeta'])
|
||||||
|
|
@ -947,7 +931,6 @@ class UpdateExistingDialog(SizePersistedDialog):
|
||||||
'collision': unicode(self.collision.currentText()),
|
'collision': unicode(self.collision.currentText()),
|
||||||
'updatemeta': self.updatemeta.isChecked(),
|
'updatemeta': self.updatemeta.isChecked(),
|
||||||
'bgmeta': self.bgmeta.isChecked(),
|
'bgmeta': self.bgmeta.isChecked(),
|
||||||
'updateepubcover': self.updateepubcover.isChecked(),
|
|
||||||
'smarten_punctuation':self.prefs['smarten_punctuation'],
|
'smarten_punctuation':self.prefs['smarten_punctuation'],
|
||||||
'do_wordcount':self.prefs['do_wordcount'],
|
'do_wordcount':self.prefs['do_wordcount'],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ from fanficfare.six import ensure_text, string_types, text_type as unicode
|
||||||
# profile.print_stats()
|
# profile.print_stats()
|
||||||
# return profiled_func
|
# return profiled_func
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -116,6 +115,20 @@ from calibre_plugins.fanficfare_plugin.dialogs import (
|
||||||
save_collisions, question_dialog_all,
|
save_collisions, question_dialog_all,
|
||||||
NotGoingToDownload, RejectUrlEntry )
|
NotGoingToDownload, RejectUrlEntry )
|
||||||
|
|
||||||
|
from calibre.gui2.ui import get_gui
|
||||||
|
def do_updateepubcover_warning(func):
|
||||||
|
def profiled_func(*args, **kwargs):
|
||||||
|
if prefs['updateepubcover'] == False:
|
||||||
|
confirm('<p>'+_("FanFicFare's <i>Update EPUB Cover?</i> Download Options checkbox has been removed.")+'<\p>'+
|
||||||
|
'<p>'+_("It was a very old setting that didn't quite do what users expected.")+'<\p>'+
|
||||||
|
'<p>'+_("You are getting this warning because you had <i>Default Update EPUB Cover when Updating EPUB?</i> unchecked.")+'<\p>'+
|
||||||
|
'<p>'+_("To keep the same behavior, you can add these lines to your personal.ini:")+'<\p>'+
|
||||||
|
'<p><b>[overrides]<br>never_make_cover:true<\p>'+
|
||||||
|
'<p>'+_("Click <a href='https://github.com/JimmXinu/FanFicFare'>this link</a> for more information.")+'<\p>',
|
||||||
|
'fff_updateepubcover_removed', get_gui(), show_cancel_button=False, title=_("FanFicFare Warning"))
|
||||||
|
return func(*args, **kwargs)
|
||||||
|
return profiled_func
|
||||||
|
|
||||||
# because calibre immediately transforms html into zip and don't want
|
# because calibre immediately transforms html into zip and don't want
|
||||||
# to have an 'if html'. db.has_format is cool with the case mismatch,
|
# to have an 'if html'. db.has_format is cool with the case mismatch,
|
||||||
# but if I'm doing it anyway...
|
# but if I'm doing it anyway...
|
||||||
|
|
@ -597,7 +610,6 @@ class FanFicFarePlugin(InterfaceAction):
|
||||||
'collision': extraoptions.get('collision',save_collisions[prefs['collision']]),
|
'collision': extraoptions.get('collision',save_collisions[prefs['collision']]),
|
||||||
'updatemeta': prefs['updatemeta'],
|
'updatemeta': prefs['updatemeta'],
|
||||||
'bgmeta': False,
|
'bgmeta': False,
|
||||||
'updateepubcover': prefs['updateepubcover'],
|
|
||||||
'smarten_punctuation':prefs['smarten_punctuation'],
|
'smarten_punctuation':prefs['smarten_punctuation'],
|
||||||
'do_wordcount':prefs['do_wordcount'],
|
'do_wordcount':prefs['do_wordcount'],
|
||||||
'add_tag':prefs['imaptags'],
|
'add_tag':prefs['imaptags'],
|
||||||
|
|
@ -866,6 +878,7 @@ class FanFicFarePlugin(InterfaceAction):
|
||||||
if confirm(message,'fff_reject_non_fanfiction', self.gui):
|
if confirm(message,'fff_reject_non_fanfiction', self.gui):
|
||||||
self.gui.iactions['Remove Books'].delete_books()
|
self.gui.iactions['Remove Books'].delete_books()
|
||||||
|
|
||||||
|
@do_updateepubcover_warning
|
||||||
def add_dialog(self,
|
def add_dialog(self,
|
||||||
checked,
|
checked,
|
||||||
url_list_text=None,
|
url_list_text=None,
|
||||||
|
|
@ -1235,8 +1248,7 @@ class FanFicFarePlugin(InterfaceAction):
|
||||||
options={'fileform':'epub',
|
options={'fileform':'epub',
|
||||||
'collision':ADDNEW,
|
'collision':ADDNEW,
|
||||||
'updatemeta':True,
|
'updatemeta':True,
|
||||||
'bgmeta':False,
|
'bgmeta':False},
|
||||||
'updateepubcover':True},
|
|
||||||
merge=False):
|
merge=False):
|
||||||
'''
|
'''
|
||||||
Update passed in book dict with metadata from website and
|
Update passed in book dict with metadata from website and
|
||||||
|
|
@ -1258,7 +1270,6 @@ class FanFicFarePlugin(InterfaceAction):
|
||||||
collision = book['collision'] = options['collision']
|
collision = book['collision'] = options['collision']
|
||||||
updatemeta= options['updatemeta']
|
updatemeta= options['updatemeta']
|
||||||
bgmeta= options['bgmeta']
|
bgmeta= options['bgmeta']
|
||||||
updateepubcover= options['updateepubcover']
|
|
||||||
|
|
||||||
## Check reject list. Redundant with below for when story URL
|
## Check reject list. Redundant with below for when story URL
|
||||||
## changes, but also kept here to avoid network hit in most
|
## changes, but also kept here to avoid network hit in most
|
||||||
|
|
@ -1666,8 +1677,7 @@ class FanFicFarePlugin(InterfaceAction):
|
||||||
options={'fileform':'epub',
|
options={'fileform':'epub',
|
||||||
'collision':ADDNEW,
|
'collision':ADDNEW,
|
||||||
'updatemeta':True,
|
'updatemeta':True,
|
||||||
'bgmeta':False,
|
'bgmeta':False},
|
||||||
'updateepubcover':True},
|
|
||||||
merge=False):
|
merge=False):
|
||||||
'''
|
'''
|
||||||
Called by LoopProgressDialog to start story downloads BG processing.
|
Called by LoopProgressDialog to start story downloads BG processing.
|
||||||
|
|
@ -1796,8 +1806,7 @@ class FanFicFarePlugin(InterfaceAction):
|
||||||
options={'fileform':'epub',
|
options={'fileform':'epub',
|
||||||
'collision':ADDNEW,
|
'collision':ADDNEW,
|
||||||
'updatemeta':True,
|
'updatemeta':True,
|
||||||
'bgmeta':False,
|
'bgmeta':False},
|
||||||
'updateepubcover':True},
|
|
||||||
errorcol_label=None,
|
errorcol_label=None,
|
||||||
lastcheckedcol_label=None):
|
lastcheckedcol_label=None):
|
||||||
|
|
||||||
|
|
@ -2464,6 +2473,11 @@ class FanFicFarePlugin(InterfaceAction):
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
# First, should cover generation happen at all?
|
||||||
|
# everything after here is cover processing.
|
||||||
|
if not book['added'] and prefs['covernewonly']:
|
||||||
|
return
|
||||||
|
|
||||||
logger.info("cover_image:%s"%book['all_metadata']['cover_image'])
|
logger.info("cover_image:%s"%book['all_metadata']['cover_image'])
|
||||||
# updating calibre cover from book.
|
# updating calibre cover from book.
|
||||||
if options['fileform'] == 'epub' and (
|
if options['fileform'] == 'epub' and (
|
||||||
|
|
@ -2479,7 +2493,6 @@ class FanFicFarePlugin(InterfaceAction):
|
||||||
except:
|
except:
|
||||||
logger.info("Failed to set_cover, skipping")
|
logger.info("Failed to set_cover, skipping")
|
||||||
|
|
||||||
# First, should cover generation happen at all?
|
|
||||||
# logger.debug("book['all_metadata']['cover_image']:%s"%book['all_metadata']['cover_image'])
|
# logger.debug("book['all_metadata']['cover_image']:%s"%book['all_metadata']['cover_image'])
|
||||||
if (book['added'] or not prefs['gcnewonly']) and ( # skip if not new book and gcnewonly is True
|
if (book['added'] or not prefs['gcnewonly']) and ( # skip if not new book and gcnewonly is True
|
||||||
prefs['gencalcover'] == SAVE_YES ## yes, always
|
prefs['gencalcover'] == SAVE_YES ## yes, always
|
||||||
|
|
|
||||||
|
|
@ -222,8 +222,8 @@ def do_download_for_worker(book,options,merge,notification=lambda x,y:x):
|
||||||
options['fileform'],
|
options['fileform'],
|
||||||
options['personal.ini'])
|
options['personal.ini'])
|
||||||
|
|
||||||
if not options['updateepubcover'] and 'epub_for_update' in book and book['collision'] in (UPDATE, UPDATEALWAYS):
|
# if not options['updateepubcover'] and 'epub_for_update' in book and book['collision'] in (UPDATE, UPDATEALWAYS):
|
||||||
configuration.set("overrides","never_make_cover","true")
|
# configuration.set("overrides","never_make_cover","true")
|
||||||
|
|
||||||
# images only for epub, html, even if the user mistakenly
|
# images only for epub, html, even if the user mistakenly
|
||||||
# turned it on else where.
|
# turned it on else where.
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ default_prefs['reject_delete_default'] = True
|
||||||
|
|
||||||
default_prefs['updatemeta'] = True
|
default_prefs['updatemeta'] = True
|
||||||
default_prefs['bgmeta'] = False
|
default_prefs['bgmeta'] = False
|
||||||
default_prefs['updateepubcover'] = False
|
default_prefs['updateepubcover'] = True # removed in favor of always True Sep 2022
|
||||||
default_prefs['keeptags'] = False
|
default_prefs['keeptags'] = False
|
||||||
default_prefs['suppressauthorsort'] = False
|
default_prefs['suppressauthorsort'] = False
|
||||||
default_prefs['suppresstitlesort'] = False
|
default_prefs['suppresstitlesort'] = False
|
||||||
|
|
@ -158,6 +158,7 @@ default_prefs['addtoreadlists'] = False
|
||||||
default_prefs['addtolistsonread'] = False
|
default_prefs['addtolistsonread'] = False
|
||||||
default_prefs['autounnew'] = False
|
default_prefs['autounnew'] = False
|
||||||
|
|
||||||
|
default_prefs['covernewonly'] = False
|
||||||
default_prefs['updatecalcover'] = SAVE_YES_IF_IMG
|
default_prefs['updatecalcover'] = SAVE_YES_IF_IMG
|
||||||
default_prefs['gencalcover'] = SAVE_YES
|
default_prefs['gencalcover'] = SAVE_YES
|
||||||
default_prefs['updatecover'] = False
|
default_prefs['updatecover'] = False
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue