Merge pull request #213 from lordwelch/series_sort
Cleanup settings from #200
This commit is contained in:
commit
773735bf6e
@ -76,8 +76,8 @@ class IssueIdentifier:
|
||||
self.length_delta_thresh = settings.id_length_delta_thresh
|
||||
|
||||
# used to eliminate unlikely publishers
|
||||
self.publisher_blacklist = [
|
||||
s.strip().lower() for s in settings.id_publisher_blacklist.split(',')]
|
||||
self.publisher_filter = [
|
||||
s.strip().lower() for s in settings.id_publisher_filter.split(',')]
|
||||
|
||||
self.additional_metadata = GenericMetadata()
|
||||
self.output_function = IssueIdentifier.defaultWriteOutput
|
||||
@ -100,8 +100,8 @@ class IssueIdentifier:
|
||||
def setNameLengthDeltaThreshold(self, delta):
|
||||
self.length_delta_thresh = delta
|
||||
|
||||
def setPublisherBlackList(self, blacklist):
|
||||
self.publisher_blacklist = blacklist
|
||||
def setPublisherFilter(self, filter):
|
||||
self.publisher_filter = filter
|
||||
|
||||
def setHasherAlgorithm(self, algo):
|
||||
self.image_hasher = algo
|
||||
@ -394,7 +394,7 @@ class IssueIdentifier:
|
||||
if keys['month'] is not None:
|
||||
self.log_msg("\tMonth: " + str(keys['month']))
|
||||
|
||||
#self.log_msg("Publisher Blacklist: " + str(self.publisher_blacklist))
|
||||
#self.log_msg("Publisher Filter: " + str(self.publisher_filter))
|
||||
comicVine = ComicVineTalker()
|
||||
comicVine.wait_for_rate_limit = self.waitAndRetryOnRateLimit
|
||||
|
||||
@ -442,11 +442,11 @@ class IssueIdentifier:
|
||||
len(shortened_key) + self.length_delta_thresh):
|
||||
length_approved = True
|
||||
|
||||
# remove any series from publishers on the blacklist
|
||||
# remove any series from publishers on the filter
|
||||
if item['publisher'] is not None:
|
||||
publisher = item['publisher']['name']
|
||||
if publisher is not None and publisher.lower(
|
||||
) in self.publisher_blacklist:
|
||||
) in self.publisher_filter:
|
||||
publisher_approved = False
|
||||
|
||||
if length_approved and publisher_approved and date_approved:
|
||||
|
@ -78,7 +78,7 @@ class ComicTaggerSettings:
|
||||
|
||||
# identifier settings
|
||||
self.id_length_delta_thresh = 5
|
||||
self.id_publisher_blacklist = "Panini Comics, Abril, Planeta DeAgostini, Editorial Televisa, Dino Comics"
|
||||
self.id_publisher_filter = "Panini Comics, Abril, Planeta DeAgostini, Editorial Televisa, Dino Comics"
|
||||
|
||||
# Show/ask dialog flags
|
||||
self.ask_about_cbi_in_rar = True
|
||||
@ -97,7 +97,7 @@ class ComicTaggerSettings:
|
||||
|
||||
self.sort_series_by_year = True
|
||||
self.exact_series_matches_first = True
|
||||
self.always_use_publisher_blacklist = False
|
||||
self.always_use_publisher_filter = False
|
||||
|
||||
# CBL Tranform settings
|
||||
|
||||
@ -226,9 +226,9 @@ class ComicTaggerSettings:
|
||||
if self.config.has_option('identifier', 'id_length_delta_thresh'):
|
||||
self.id_length_delta_thresh = self.config.getint(
|
||||
'identifier', 'id_length_delta_thresh')
|
||||
if self.config.has_option('identifier', 'id_publisher_blacklist'):
|
||||
self.id_publisher_blacklist = self.config.get(
|
||||
'identifier', 'id_publisher_blacklist')
|
||||
if self.config.has_option('identifier', 'id_publisher_filter'):
|
||||
self.id_publisher_filter = self.config.get(
|
||||
'identifier', 'id_publisher_filter')
|
||||
|
||||
if self.config.has_option('filenameparser', 'parse_scan_info'):
|
||||
self.parse_scan_info = self.config.getboolean(
|
||||
@ -265,9 +265,9 @@ class ComicTaggerSettings:
|
||||
if self.config.has_option('comicvine', 'exact_series_matches_first'):
|
||||
self.exact_series_matches_first = self.config.getboolean(
|
||||
'comicvine', 'exact_series_matches_first')
|
||||
if self.config.has_option('comicvine', 'always_use_publisher_blacklist'):
|
||||
self.always_use_publisher_blacklist = self.config.getboolean(
|
||||
'comicvine', 'always_use_publisher_blacklist')
|
||||
if self.config.has_option('comicvine', 'always_use_publisher_filter'):
|
||||
self.always_use_publisher_filter = self.config.getboolean(
|
||||
'comicvine', 'always_use_publisher_filter')
|
||||
|
||||
if self.config.has_option('comicvine', 'cv_api_key'):
|
||||
self.cv_api_key = self.config.get('comicvine', 'cv_api_key')
|
||||
@ -390,8 +390,8 @@ class ComicTaggerSettings:
|
||||
self.id_length_delta_thresh)
|
||||
self.config.set(
|
||||
'identifier',
|
||||
'id_publisher_blacklist',
|
||||
self.id_publisher_blacklist)
|
||||
'id_publisher_filter',
|
||||
self.id_publisher_filter)
|
||||
|
||||
if not self.config.has_section('dialogflags'):
|
||||
self.config.add_section('dialogflags')
|
||||
@ -429,7 +429,7 @@ class ComicTaggerSettings:
|
||||
self.config.set(
|
||||
'comicvine', 'exact_series_matches_first', self.exact_series_matches_first)
|
||||
self.config.set(
|
||||
'comicvine', 'always_use_publisher_blacklist', self.always_use_publisher_blacklist)
|
||||
'comicvine', 'always_use_publisher_filter', self.always_use_publisher_filter)
|
||||
|
||||
self.config.set('comicvine', 'cv_api_key', self.cv_api_key)
|
||||
|
||||
|
@ -94,12 +94,12 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
|
||||
pblTip = (
|
||||
"""<html>
|
||||
The <b>Publisher Blacklist</b> is for eliminating automatic matches to certain publishers
|
||||
The <b>Publisher Filter</b> is for eliminating automatic matches to certain publishers
|
||||
that you know are incorrect. Useful for avoiding international re-prints with same
|
||||
covers or series names. Enter publisher names separated by commas.
|
||||
</html>"""
|
||||
)
|
||||
self.tePublisherBlacklist.setToolTip(pblTip)
|
||||
self.tePublisherFilter.setToolTip(pblTip)
|
||||
|
||||
validator = QtGui.QIntValidator(1, 4, self)
|
||||
self.leIssueNumPadding.setValidator(validator)
|
||||
@ -120,8 +120,8 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.leRarExePath.setText(self.settings.rar_exe_path)
|
||||
self.leNameLengthDeltaThresh.setText(
|
||||
str(self.settings.id_length_delta_thresh))
|
||||
self.tePublisherBlacklist.setPlainText(
|
||||
self.settings.id_publisher_blacklist)
|
||||
self.tePublisherFilter.setPlainText(
|
||||
self.settings.id_publisher_filter)
|
||||
|
||||
if self.settings.check_for_new_version:
|
||||
self.cbxCheckForNewVersion.setCheckState(QtCore.Qt.Checked)
|
||||
@ -136,8 +136,8 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
if self.settings.remove_html_tables:
|
||||
self.cbxRemoveHtmlTables.setCheckState(QtCore.Qt.Checked)
|
||||
|
||||
if self.settings.always_use_publisher_blacklist:
|
||||
self.cbxUseBlackFilter.setCheckState(QtCore.Qt.Checked)
|
||||
if self.settings.always_use_publisher_filter:
|
||||
self.cbxUseFilter.setCheckState(QtCore.Qt.Checked)
|
||||
if self.settings.sort_series_by_year:
|
||||
self.cbxSortByYear.setCheckState(QtCore.Qt.Checked)
|
||||
if self.settings.exact_series_matches_first:
|
||||
@ -193,8 +193,8 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
|
||||
self.settings.id_length_delta_thresh = int(
|
||||
self.leNameLengthDeltaThresh.text())
|
||||
self.settings.id_publisher_blacklist = str(
|
||||
self.tePublisherBlacklist.toPlainText())
|
||||
self.settings.id_publisher_filter = str(
|
||||
self.tePublisherFilter.toPlainText())
|
||||
|
||||
self.settings.parse_scan_info = self.cbxParseScanInfo.isChecked()
|
||||
|
||||
@ -202,7 +202,7 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.settings.clear_form_before_populating_from_cv = self.cbxClearFormBeforePopulating.isChecked()
|
||||
self.settings.remove_html_tables = self.cbxRemoveHtmlTables.isChecked()
|
||||
|
||||
self.settings.always_use_publisher_blacklist = self.cbxUseBlackFilter.isChecked()
|
||||
self.settings.always_use_publisher_filter = self.cbxUseFilter.isChecked()
|
||||
self.settings.sort_series_by_year = self.cbxSortByYear.isChecked()
|
||||
self.settings.exact_series_matches_first = self.cbxExactMatches.isChecked()
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>702</width>
|
||||
<height>432</height>
|
||||
<height>478</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -28,7 +28,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@ -133,7 +133,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Identifier</string>
|
||||
<string>Searching</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
@ -187,15 +187,15 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Publisher Blacklist:</string>
|
||||
<string>Publisher Filter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPlainTextEdit" name="tePublisherBlacklist">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPlainTextEdit" name="tePublisherFilter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -204,6 +204,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="cbxUseFilter">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Applies the <span style=" font-weight:600;">Publisher Filter</span> on all searches.<br/>The search window has a dynamic toggle to show the unfiltered results.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Always use Publisher Filter on "manual" searches:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -263,23 +280,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbxUseBlackFilter">
|
||||
<property name="text">
|
||||
<string>Always use Publisher Blacklist on 'manual' searches</string>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -154,7 +154,7 @@
|
||||
<string>Filter Publishers</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Filter the publishers based on the publisher blacklist.</string>
|
||||
<string>Filter the publishers based on the publisher filter.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -126,7 +126,7 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
|
||||
self.cover_index_list = cover_index_list
|
||||
self.cv_search_results = None
|
||||
|
||||
self.use_blackList = self.settings.always_use_publisher_blacklist
|
||||
self.use_filter = self.settings.always_use_publisher_filter
|
||||
|
||||
self.twList.resizeColumnsToContents()
|
||||
self.twList.currentItemChanged.connect(self.currentItemChanged)
|
||||
@ -135,7 +135,7 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
|
||||
self.btnIssues.clicked.connect(self.showIssues)
|
||||
self.btnAutoSelect.clicked.connect(self.autoSelect)
|
||||
|
||||
self.cbxFilter.setChecked(self.use_blackList)
|
||||
self.cbxFilter.setChecked(self.use_filter)
|
||||
self.cbxFilter.toggled.connect(self.filterToggled)
|
||||
|
||||
self.updateButtons()
|
||||
@ -157,9 +157,9 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
|
||||
def requery(self,):
|
||||
self.performQuery(refresh=True)
|
||||
self.twList.selectRow(0)
|
||||
|
||||
|
||||
def filterToggled(self):
|
||||
self.use_blackList = not self.use_blackList
|
||||
self.use_filter = not self.use_filter
|
||||
self.performQuery(refresh=False)
|
||||
|
||||
def autoSelect(self):
|
||||
@ -304,7 +304,6 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
|
||||
self.progdialog.canceled.connect(self.searchCanceled)
|
||||
self.progdialog.setModal(True)
|
||||
self.progdialog.setMinimumDuration(300)
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
self.search_thread = SearchThread(self.series_name, refresh)
|
||||
self.search_thread.searchComplete.connect(self.searchComplete)
|
||||
self.search_thread.progressUpdate.connect(self.searchProgressUpdate)
|
||||
@ -345,14 +344,14 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
|
||||
return
|
||||
|
||||
self.cv_search_results = self.search_thread.cv_search_results
|
||||
# filter the blacklisted publishers if setting set
|
||||
if self.use_blackList:
|
||||
# filter the publishers if enabled set
|
||||
if self.use_filter:
|
||||
try:
|
||||
publisher_blacklist = {s.strip().lower() for s in self.settings.id_publisher_blacklist.split(',')}
|
||||
publisher_filter = {s.strip().lower() for s in self.settings.id_publisher_filter.split(',')}
|
||||
# use '' as publisher name if None
|
||||
self.cv_search_results = list(filter(lambda d: ('' if d['publisher'] is None else str(d['publisher']['name']).lower()) not in publisher_blacklist, self.cv_search_results))
|
||||
self.cv_search_results = list(filter(lambda d: ('' if d['publisher'] is None else str(d['publisher']['name']).lower()) not in publisher_filter, self.cv_search_results))
|
||||
except:
|
||||
print('bad data error filtering blacklist publishers')
|
||||
print('bad data error filtering filter publishers')
|
||||
|
||||
# pre sort the data - so that we can put exact matches first afterwards
|
||||
# compare as str incase extra chars ie. '1976?'
|
||||
@ -368,7 +367,7 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
|
||||
self.cv_search_results = sorted(self.cv_search_results, key = lambda i: str(i['count_of_issues']), reverse=True)
|
||||
except:
|
||||
print('bad data error sorting results by count_of_issues')
|
||||
|
||||
|
||||
# move sanitized matches to the front
|
||||
if self.settings.exact_series_matches_first:
|
||||
try:
|
||||
@ -449,7 +448,7 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
|
||||
return
|
||||
|
||||
self.volume_id = self.twList.item(curr.row(), 0).data(QtCore.Qt.UserRole)
|
||||
|
||||
|
||||
# list selection was changed, update the info on the volume
|
||||
for record in self.cv_search_results:
|
||||
if record['id'] == self.volume_id:
|
||||
|
Loading…
Reference in New Issue
Block a user