05-sep: [infra] configurar Raspberry Pi y documentar flota
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user