dev: bump to 0.1.66 and harden resolveurl + serienstream

This commit is contained in:
2026-02-25 16:35:16 +01:00
parent 74d15cb25e
commit 73f07d20b4
20 changed files with 522 additions and 232 deletions

29
addon/search_utils.py Normal file
View File

@@ -0,0 +1,29 @@
from __future__ import annotations
import re
def normalize_search_text(value: str) -> str:
"""Normalisiert Text fuer wortbasierte Suche.
Gemeinsames Verhalten:
- lower-case
- Nicht-Alphanumerisches -> Leerzeichen
- mehrfachen Whitespace kollabieren
"""
value = (value or "").casefold()
value = re.sub(r"[^a-z0-9]+", " ", value)
value = re.sub(r"\s+", " ", value).strip()
return value
def matches_query(query: str, *, title: str) -> bool:
"""True, wenn der normalisierte Titel den normalisierten Query als ganzes Token enthaelt."""
normalized_query = normalize_search_text(query)
if not normalized_query:
return False
haystack = f" {normalize_search_text(title)} "
return f" {normalized_query} " in haystack