Make check for changing story URL configurable.

This commit is contained in:
Jim Miller 2013-08-18 15:52:51 -05:00
parent 6414a09dbd
commit e8e93b010a
4 changed files with 14 additions and 7 deletions

View file

@ -177,6 +177,7 @@ class ConfigWidget(QWidget):
prefs['includeimages'] = self.basic_tab.includeimages.isChecked() prefs['includeimages'] = self.basic_tab.includeimages.isChecked()
prefs['lookforurlinhtml'] = self.basic_tab.lookforurlinhtml.isChecked() prefs['lookforurlinhtml'] = self.basic_tab.lookforurlinhtml.isChecked()
prefs['checkforseriesurlid'] = self.basic_tab.checkforseriesurlid.isChecked() prefs['checkforseriesurlid'] = self.basic_tab.checkforseriesurlid.isChecked()
prefs['checkforurlchange'] = self.basic_tab.checkforurlchange.isChecked()
prefs['injectseries'] = self.basic_tab.injectseries.isChecked() prefs['injectseries'] = self.basic_tab.injectseries.isChecked()
prefs['smarten_punctuation'] = self.basic_tab.smarten_punctuation.isChecked() prefs['smarten_punctuation'] = self.basic_tab.smarten_punctuation.isChecked()
@ -352,6 +353,11 @@ class BasicTab(QWidget):
self.checkforseriesurlid.setChecked(prefs['checkforseriesurlid']) self.checkforseriesurlid.setChecked(prefs['checkforseriesurlid'])
self.l.addWidget(self.checkforseriesurlid) self.l.addWidget(self.checkforseriesurlid)
self.checkforurlchange = QCheckBox("Check for changed Story URL?",self)
self.checkforurlchange.setToolTip("Warn you if an update will change the URL of an existing book.")
self.checkforurlchange.setChecked(prefs['checkforurlchange'])
self.l.addWidget(self.checkforurlchange)
self.lookforurlinhtml = QCheckBox("Search EPUB text for Story URL?",self) self.lookforurlinhtml = QCheckBox("Search EPUB text for Story URL?",self)
self.lookforurlinhtml.setToolTip("Look for first valid story URL inside EPUB text if not found in metadata.\nSomewhat risky, could find wrong URL depending on EPUB content.\nAlso finds and corrects bad ffnet URLs from ficsaver.com files.") self.lookforurlinhtml.setToolTip("Look for first valid story URL inside EPUB text if not found in metadata.\nSomewhat risky, could find wrong URL depending on EPUB content.\nAlso finds and corrects bad ffnet URLs from ficsaver.com files.")
self.lookforurlinhtml.setChecked(prefs['lookforurlinhtml']) self.lookforurlinhtml.setChecked(prefs['lookforurlinhtml'])
@ -503,7 +509,7 @@ class PersonalIniTab(QWidget):
self.ini = QTextEdit(self) self.ini = QTextEdit(self)
try: try:
self.ini.setFont(QFont("Courier", self.ini.setFont(QFont("Courier",
self.plugin_action.gui.font().pointSize()+1)); self.plugin_action.gui.font().pointSize()+1))
except Exception as e: except Exception as e:
print("Couldn't get font: %s"%e) print("Couldn't get font: %s"%e)
self.ini.setLineWrapMode(QTextEdit.NoWrap) self.ini.setLineWrapMode(QTextEdit.NoWrap)
@ -539,7 +545,7 @@ class ShowDefaultsIniDialog(QDialog):
self.ini.setToolTip("These are all of the plugin's configurable options\nand their default settings.") self.ini.setToolTip("These are all of the plugin's configurable options\nand their default settings.")
try: try:
self.ini.setFont(QFont("Courier", self.ini.setFont(QFont("Courier",
get_gui().font().pointSize()+1)); get_gui().font().pointSize()+1))
except Exception as e: except Exception as e:
print("Couldn't get font: %s"%e) print("Couldn't get font: %s"%e)
self.ini.setLineWrapMode(QTextEdit.NoWrap) self.ini.setLineWrapMode(QTextEdit.NoWrap)

View file

@ -164,7 +164,7 @@ class DroppableQTextEdit(QTextEdit):
def canInsertFromMimeData(self, source): def canInsertFromMimeData(self, source):
if source.hasUrls(): if source.hasUrls():
return True; return True
else: else:
return QTextEdit.canInsertFromMimeData(self,source) return QTextEdit.canInsertFromMimeData(self,source)
@ -208,7 +208,7 @@ class AddNewDialog(SizePersistedDialog):
self.groupbox.setChecked(False) self.groupbox.setChecked(False)
self.groupbox.setFlat(True) self.groupbox.setFlat(True)
print("style:%s"%self.groupbox.styleSheet()) print("style:%s"%self.groupbox.styleSheet())
self.groupbox.setStyleSheet(gpstyle); self.groupbox.setStyleSheet(gpstyle)
self.gbf = QFrame() self.gbf = QFrame()
self.gbl = QVBoxLayout() self.gbl = QVBoxLayout()

View file

@ -628,7 +628,7 @@ class FanFictionDownLoaderPlugin(InterfaceAction):
return return
if not id_list: if not id_list:
id_list = self.gui.library_view.get_selected_ids(); id_list = self.gui.library_view.get_selected_ids()
if len(id_list) == 0: if len(id_list) == 0:
self.gui.status_bar.show_message(_('No Selected Books to Update'), 3000) self.gui.status_bar.show_message(_('No Selected Books to Update'), 3000)
@ -918,7 +918,7 @@ class FanFictionDownLoaderPlugin(InterfaceAction):
if book_id and mi: # book_id and mi only set if matched by title/author. if book_id and mi: # book_id and mi only set if matched by title/author.
liburl = self.get_story_url(db,book_id) liburl = self.get_story_url(db,book_id)
if book['url'] != liburl: if book['url'] != liburl and prefs['checkforurlchange']:
if collision in (OVERWRITE,OVERWRITEALWAYS): if collision in (OVERWRITE,OVERWRITEALWAYS):
updat="overwrit" updat="overwrit"
else: else:
@ -1852,7 +1852,7 @@ class FanFictionDownLoaderPlugin(InterfaceAction):
book['title'] = series book['title'] = series
for sr in serieslist: for sr in serieslist:
if series != sr: if series != sr:
book['title'] = deftitle; book['title'] = deftitle
break break
configuration = get_ffdl_config(book['url'],fileform) configuration = get_ffdl_config(book['url'],fileform)

View file

@ -40,6 +40,7 @@ default_prefs['adddialogstaysontop'] = False
default_prefs['includeimages'] = False default_prefs['includeimages'] = False
default_prefs['lookforurlinhtml'] = False default_prefs['lookforurlinhtml'] = False
default_prefs['checkforseriesurlid'] = True default_prefs['checkforseriesurlid'] = True
default_prefs['checkforurlchange'] = True
default_prefs['injectseries'] = False default_prefs['injectseries'] = False
default_prefs['smarten_punctuation'] = False default_prefs['smarten_punctuation'] = False