Dev #9

Merged
unai merged 4 commits from Dev into main 2026-02-02 16:45:34 +00:00
2 changed files with 27 additions and 1 deletions
Showing only changes of commit 1cf174e896 - Show all commits

View File

@ -24,6 +24,20 @@ class Settings(BaseSettings):
env_file=".env", env_file_encoding="utf-8", extra="ignore"
)
# Filtros por prefijo de nombre de canal
include_text: list[str] = Field(
default_factory=list,
description="Lista de textos obligatorios. Si se define, el canal DEBE contener al menos uno.",
)
exclude_text: list[str] = Field(
default_factory=list,
description="Lista de textos prohibidos. Si el canal contiene uno, se descarta.",
)
model_config = SettingsConfigDict(
env_file=".env", env_file_encoding="utf-8", extra="ignore"
)
# Instancia única de configuración
settings = Settings()

View File

@ -61,7 +61,19 @@ class PlaylistManager:
stream_id = channel.get("stream_id")
icon = channel.get("stream_icon", "")
cat_id = channel.get("category_id", "")
# Filtros de inclusión/exclusión por prefijo de nombre
if settings.include_text:
if not any(
name.lower().startswith(inc_text.lower())
for inc_text in settings.include_text
):
continue
if settings.exclude_text:
if any(
exc_text.lower() in name.lower()
for exc_text in settings.exclude_text
):
continue
# Construir URL directa
stream_url = (
f"{settings.host}/live/{settings.username}/"