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/genre_utils.py Normal file
View File

@@ -0,0 +1,29 @@
from __future__ import annotations
import re
from html import unescape
def normalize_genre_label(raw: str) -> str:
"""Normalisiert Genre-Bezeichner aus HTML-Labels oder Datenattributen."""
text = unescape(re.sub(r"\s+", " ", str(raw or ""))).strip()
if not text:
return ""
key_prefix = "filter.genre_"
if text.casefold().startswith(key_prefix):
slug = text[len(key_prefix) :].strip().casefold()
slug = slug.replace("_", "-")
slug = re.sub(r"[^a-z0-9-]+", "-", slug).strip("-")
if not slug:
return ""
special = {
"doku-soap": "Doku-Soap",
"scifi": "SciFi",
"fighting-shounen": "Fighting-Shounen",
}
if slug in special:
return special[slug]
return " ".join(chunk.capitalize() for chunk in slug.split("-") if chunk)
return text