From 9aa42c1ca705c8c59414922c79b4f37f0bfc6374 Mon Sep 17 00:00:00 2001 From: Mizaki Date: Fri, 3 Feb 2023 21:38:17 +0000 Subject: [PATCH] Add series match threshold back into search_for_series as it is no longer available via the talkers own settings. --- comictaggerlib/seriesselectionwindow.py | 2 +- comictalker/talkerbase.py | 1 + comictalker/talkers/comicvine.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/comictaggerlib/seriesselectionwindow.py b/comictaggerlib/seriesselectionwindow.py index bfaa0d6..5bcad3b 100644 --- a/comictaggerlib/seriesselectionwindow.py +++ b/comictaggerlib/seriesselectionwindow.py @@ -65,7 +65,7 @@ class SearchThread(QtCore.QThread): try: self.ct_error = False self.ct_search_results = self.talker_api.search_for_series( - self.series_name, self.prog_callback, self.refresh, self.literal + self.series_name, self.prog_callback, self.refresh, self.literal, self.series_match_thresh ) except TalkerError as e: self.ct_search_results = [] diff --git a/comictalker/talkerbase.py b/comictalker/talkerbase.py index 94daf64..c3960c3 100644 --- a/comictalker/talkerbase.py +++ b/comictalker/talkerbase.py @@ -171,6 +171,7 @@ class ComicTalker: callback: Callable[[int, int], None] | None = None, refresh_cache: bool = False, literal: bool = False, + series_match_thresh: int = 90, ) -> list[ComicSeries]: """ This function should return a list of series that match the given series name diff --git a/comictalker/talkers/comicvine.py b/comictalker/talkers/comicvine.py index 07a6f83..820cad4 100644 --- a/comictalker/talkers/comicvine.py +++ b/comictalker/talkers/comicvine.py @@ -177,7 +177,6 @@ class ComicVineTalker(ComicTalker): # Default settings self.api_url: str = "https://comicvine.gamespot.com/api" self.api_key: str = "27431e6787042105bd3e47e169a624521f89f3a4" - self.series_match_thresh: int = 90 self.remove_html_tables: bool = False self.use_series_start_as_volume: bool = False self.wait_for_rate_limit: bool = False @@ -412,6 +411,7 @@ class ComicVineTalker(ComicTalker): callback: Callable[[int, int], None] | None = None, refresh_cache: bool = False, literal: bool = False, + series_match_thresh: int = 90, ) -> list[ComicSeries]: # Sanitize the series name for comicvine searching, comicvine search ignore symbols search_series_name = utils.sanitize_title(series_name, literal) @@ -470,7 +470,7 @@ class ComicVineTalker(ComicTalker): if not literal: # Stop searching once any entry falls below the threshold stop_searching = any( - not utils.titles_match(search_series_name, series["name"], self.series_match_thresh) + not utils.titles_match(search_series_name, series["name"], series_match_thresh) for series in cv_response["results"] )