コード例 #1
0
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({})
コード例 #2
0
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({})
コード例 #3
0
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({})
コード例 #4
0
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({})