async def torrent_remove(ws, **args): ids = [convert.get_synapse_id(i) for i in args["ids"]] for torrent in ids: await ws.send({ "type": "REMOVE_RESOURCE", "id": torrent, "artifacts": bool(args.get("delete-local-data")) }) return response({})
async def torrent_set(ws, **args): # TODO: no ids field means "all ids" ids = [convert.get_synapse_id(i) for i in args["ids"]] update = convert.from_torrent(args) for torrent in ids: await ws.send({ "type": "UPDATE_RESOURCE", "resource": { "id": torrent }.update(update) }) return response({})
async def torrent_verify(ws, **args): # TODO: no ids field means "all ids" ids = [convert.get_synapse_id(i) for i in args["ids"]] serial = await ws.send({"type": "VALIDATE_RESOURCES", "ids": ids}) return response({})
async def torrent_stop(ws, **args): # TODO: no ids field means "all ids" ids = [convert.get_synapse_id(i) for i in args["ids"]] for torrent in ids: await ws.send({"type": "PAUSE_TORRENT", "id": torrent}) return response({})