From c1b17201e291a062b6c88539b3ead853ef726005 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 12 Nov 2024 19:59:58 +0100 Subject: [PATCH] fix tts filter --- .pre-commit-config.yaml | 4 ++-- src/__init__.py | 2 +- src/tts.py | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b5c8f3b..0127720 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_install_hook_types: [pre-push] repos: - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v19.1.2 + rev: v19.1.3 hooks: - id: clang-format files: \.(cpp|h)$ @@ -24,7 +24,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.0 + rev: v0.7.3 hooks: - id: ruff args: [--fix] diff --git a/src/__init__.py b/src/__init__.py index 0b3851a..ac8a77b 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -2,4 +2,4 @@ TP = concurrent.futures.ThreadPoolExecutor() -__version__ = "6.0.0alpha1" +__version__ = "6.0.0alpha2" diff --git a/src/tts.py b/src/tts.py index 9dbfe9c..87581fa 100644 --- a/src/tts.py +++ b/src/tts.py @@ -12,6 +12,7 @@ LAST_ITEM = [] LOGGER = logging.getLogger(__name__) _DATA_QUEUE = queue.Queue(maxsize=100) +TO_FILTER = ["Champions who earn the favor of"] class ItemIdentifiers(enum.Enum): @@ -31,7 +32,7 @@ def find_item(self) -> None: while True: data = fix_data(_DATA_QUEUE.get()) local_cache.append(data) - if not filter_data and ( + if not filter_data(data) and ( any(word in data.lower() for word in ["mouse button"]) and (start := find_item_start(local_cache)) is not None ): global LAST_ITEM @@ -111,9 +112,7 @@ def find_item_start(data: list[str]) -> int | None: def filter_data(data: str) -> True: - to_filter = ["Champions who earn the favor of"] - - return any(word in data for word in to_filter) + return any(word in data for word in TO_FILTER) def fix_data(data: str) -> str: