05-sep: [infra] configurar Raspberry Pi y documentar flota

This commit is contained in:
juanjo
2026-09-05 15:46:47 +02:00
parent 1e0ed24663
commit 770b9f7ee2
6 changed files with 311 additions and 8 deletions

View File

@@ -149,6 +149,13 @@ def human_size(n):
return f"{n:.1f}PB"
def progress_bar(percent, width=12):
"""Genera una barra de progreso compacta para mensajes de Telegram."""
percent = max(0.0, min(100.0, float(percent or 0)))
filled = int(round(percent * width / 100))
return "█" * filled + "░" * (width - filled)
def listar_descargas(hablar_solo_activas=True, session=None):
"""Devuelve (lineas_texto, activas). Lista las tareas de Download Station
con estado, porcentaje de progreso, tamaño descargado y velocidad.
@@ -181,7 +188,7 @@ def listar_descargas(hablar_solo_activas=True, session=None):
size = transfer.get("size_downloaded") or 0
speed = transfer.get("speed_download") or 0
if estado == "downloading":
activas.append(f"▶️ <b>{pct:.1f}%</b> {human_size(size)} ⬇️{speed // 1024} KB/s\n"
activas.append(f"▶️ <b>{progress_bar(pct)} {pct:.1f}%</b> {human_size(size)} ⬇️{speed // 1024} KB/s\n"
f" {titulo}")
else:
resto.append((estado, pct, size, titulo))