From 11668ce326995ef0aa77cca162c85b5e6958875b Mon Sep 17 00:00:00 2001 From: unai Date: Sun, 1 Feb 2026 19:44:25 +0000 Subject: [PATCH 1/5] Actualizar README.md --- README.md | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/README.md b/README.md index e69de29..a8d027f 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,141 @@ +# Xtream Codes M3U List Builder + +[![Python 3.14+](https://img.shields.io/badge/python-3.14+-blue.svg)](https://www.python.org/downloads/) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Docker](https://img.shields.io/badge/docker-ready-blue.svg)](https://www.docker.com/) + +Servicio Python que genera y actualiza automáticamente listas de reproducción M3U a partir de servidores **Xtream Codes API**. Ideal para centralizar y servir playlists IPTV de forma local. + +## Características +- **Actualización automática** — Regenera la playlist en intervalos configurables +- **Servidor HTTP integrado** — Sirve el archivo M3U directamente sin dependencias externas +- **Docker ready** — Despliegue simple con Docker Compose +- **Escritura atómica** — Actualiza el archivo sin interrumpir descargas activas +- **Seguridad** — Se ejecuta con usuario no privilegiado en contenedor +- **Multi-hilo** — Servidor threaded para manejar múltiples clientes simultáneos + +## Inicio Rápido + +### Con Docker (Recomendado) + +1. **Clona el repositorio:** + ```bash + git clone https://github.com/tu-usuario/xtream_codes_m3u_list_builder.git + cd xtream_codes_m3u_list_builder + ``` + +2. **Crea un archivo `.env`:** + ```env + HOST=http://tu-servidor-iptv.com + USERNAME=tu_usuario + PASSWORD=tu_contraseña + PORT=8080 + UPDATE_INTERVAL=3600 + OUTPUT_FILE=playlist.m3u + ``` + +3. **Ejecuta con Docker Compose:** + ```bash + docker compose up -d + ``` + +4. **Accede a la playlist:** + ``` + http://localhost:8080/playlist.m3u + ``` + +### Sin Docker + +1. **Requisitos:** + - Python 3.14+ + - [Poetry](https://python-poetry.org/) + +2. **Instalación:** + ```bash + poetry install + ``` + +3. **Configuración:** Crea un archivo `.env` (ver ejemplo arriba) o exporta las variables de entorno. + +4. **Ejecución:** + ```bash + poetry run python -m m3u_list_builder.main + ``` + +## Configuración + +| Variable | Descripción | Requerido | Default | +|----------|-------------|-----------|---------| +| `HOST` | URL del servidor Xtream Codes | ✅ | — | +| `USERNAME` | Usuario del servicio IPTV | ✅ | — | +| `PASSWORD` | Contraseña del servicio IPTV | ✅ | — | +| `PORT` | Puerto del servidor HTTP local | ❌ | `8080` | +| `UPDATE_INTERVAL` | Intervalo de actualización (segundos) | ❌ | `3600` | +| `OUTPUT_FILE` | Nombre del archivo M3U generado | ❌ | `playlist.m3u` | + +## Arquitectura + +``` +┌─────────────────────────────────────────────────────────┐ +│ M3U List Builder │ +├──────────────────────┬──────────────────────────────────┤ +│ Updater Thread │ HTTP Server │ +│ │ │ +│ ┌────────────────┐ │ ┌────────────────────────────┐ │ +│ │ Fetch API │ │ │ ThreadingHTTPServer │ │ +│ │ (Xtream Codes) │ │ │ │ │ +│ └───────┬────────┘ │ │ GET /playlist.m3u │ │ +│ │ │ │ │ │ +│ ┌───────▼────────┐ │ └────────────────────────────┘ │ +│ │ Generate M3U │ │ │ +│ │ (Atomic Write) │──┼──────► public/playlist.m3u │ +│ └───────┬────────┘ │ │ +│ │ │ │ +│ sleep(interval) │ │ +│ ↓ │ │ +│ [loop] │ │ +└──────────────────────┴──────────────────────────────────┘ +``` + +## Estructura del Proyecto + +``` +├── src/m3u_list_builder/ +│ ├── __init__.py +│ ├── config.py # Configuración con Pydantic Settings +│ ├── main.py # Punto de entrada +│ ├── playlist.py # Lógica de generación M3U +│ └── server.py # Servidor HTTP +├── tests/ # Tests unitarios +├── public/ # Directorio servido (playlist generada) +├── Dockerfile # Multi-stage build +├── docker-compose.yml +└── pyproject.toml # Dependencias y configuración +``` + +## Testing + +```bash +# Ejecutar tests +poetry run pytest + +# Con cobertura +poetry run pytest --cov + +# Verificar estilo (Ruff) +poetry run ruff check src/ +``` + +## Desarrollo + +El proyecto utiliza: +- **Pydantic Settings** — Validación de configuración +- **Requests** — Cliente HTTP +- **Ruff** — Linter y formatter +- **Pytest** — Testing framework + +--- + +

+ Desarrollado con ❤️ para la comunidad IPTV +

\ No newline at end of file -- 2.49.1 From a89ee4f1a020815285ccee8865757f150d78a17b Mon Sep 17 00:00:00 2001 From: unai Date: Sun, 1 Feb 2026 21:38:55 +0000 Subject: [PATCH 2/5] Updated permissions on gitea workflow --- .gitea/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 7905563..f95ad48 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -33,6 +33,9 @@ jobs: needs: test-and-lint if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest + permissions: + packages: write + contents: read steps: - uses: actions/checkout@v3 - name: Prepare Docker Metadata -- 2.49.1 From 86f8e67318bfd94093eeafb4a1162767acbc21d9 Mon Sep 17 00:00:00 2001 From: unai Date: Sun, 1 Feb 2026 21:53:10 +0000 Subject: [PATCH 3/5] Update action user for gitea publish container --- .gitea/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index f95ad48..c084bda 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -50,7 +50,7 @@ jobs: uses: docker/login-action@v2 with: registry: ${{ steps.meta.outputs.REGISTRY_HOST }} - username: ${{ gitea.actor }} + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push Docker Image -- 2.49.1 From 7c191b7ecd0304904de878a9a1b18fda69036c51 Mon Sep 17 00:00:00 2001 From: unai Date: Sun, 1 Feb 2026 22:11:14 +0000 Subject: [PATCH 4/5] Updated package access token, again --- .gitea/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index c084bda..752f8f2 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -51,7 +51,7 @@ jobs: with: registry: ${{ steps.meta.outputs.REGISTRY_HOST }} username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.PACKAGES_TOKEN }} - name: Build and Push Docker Image uses: docker/build-push-action@v4 -- 2.49.1 From d95d6d6c58eb0ffde927941e746c20952f666173 Mon Sep 17 00:00:00 2001 From: unai Date: Mon, 2 Feb 2026 16:40:26 +0000 Subject: [PATCH 5/5] Actualizar el README para acomodar la nueva funcionalidad --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a8d027f..6ee13f4 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ Servicio Python que genera y actualiza automáticamente listas de reproducción PORT=8080 UPDATE_INTERVAL=3600 OUTPUT_FILE=playlist.m3u + INCLUDE_TEXT="ES:" + EXCLUDE_TEXT=["XXX","Adultos","24/7"] ``` 3. **Ejecuta con Docker Compose:** -- 2.49.1