06-sep: [fix] borrado NAS real (id plano + error por tarea), blqdev reconstruye lista, ayudas torrents
This commit is contained in:
@@ -248,24 +248,27 @@ def listar_tareas(session=None):
|
||||
|
||||
def borrar_tarea(tid, session=None):
|
||||
"""Borra una tarea de Download Station por su id.
|
||||
Devuelve (ok, detalle)."""
|
||||
Devuelve (ok, detalle). OJO: la API responde success:true aunque falle:
|
||||
el error real va por tarea (error 0 = borrada). Con version=3 el id
|
||||
va como texto plano, no como array JSON (eso da error 544)."""
|
||||
if not session:
|
||||
session = login()
|
||||
if not session:
|
||||
return False, "No se pudo autenticar con Download Station."
|
||||
try:
|
||||
import json as _json
|
||||
r = _api("/webapi/DownloadStation/task.cgi", {
|
||||
"api": "SYNO.DownloadStation.Task",
|
||||
"version": "3",
|
||||
"method": "delete",
|
||||
"id": _json.dumps([tid]),
|
||||
"id": tid,
|
||||
}, session=session)
|
||||
except Exception as e:
|
||||
return False, str(e)
|
||||
if r.get("success"):
|
||||
detalle = r.get("data") or []
|
||||
if r.get("success") and detalle and all(
|
||||
e.get("error", -1) == 0 for e in detalle):
|
||||
return True, "ok"
|
||||
return False, str(r.get("error"))
|
||||
return False, str(detalle or r.get("error"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user