Add series match threshold back into search_for_series as it is no longer available via the talkers own settings.

This commit is contained in:
Mizaki 2023-02-03 21:38:17 +00:00
parent d12325b7f8
commit 9aa42c1ca7
3 changed files with 4 additions and 3 deletions

View File

@ -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 = []

View File

@ -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

View File

@ -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"]
)