arytonex / amphp-transmission
该软件包已被废弃且不再维护。没有推荐替代软件包。
由Amphp驱动的极其基础的Transmission JSON RPC API实现
v0.1
2020-02-07 23:38 UTC
Requires
- ext-json: *
- amphp/http-client: ^4.0@dev
This package is auto-updated.
Last update: 2021-07-08 02:42:22 UTC
README
说实话,我也不知道为什么要开源这个。
它太简单了,几乎任何人都可以做,而且做得比我更好。
不管怎样...
用法
首先,打开你的项目所在终端,并输入以下命令:
composer require arytonex/amphp-transmission
<?php require_once "vendor/autoload.php"; // assuming you're using composer, you should use it $host = '127.0.0.1'; $port = 9091; $endpoint = 'transmission/rpc/'; $transmission = new \AryToNeX\Transmission\Transmission($host, $port, $endpoint); \Amp\Loop::run(function() use ($transmission){ // EVERYTHING SHOULD BE yieldED $response = yield $transmission->addTorrent(["filename" => "/some/path/myawesomemusic.torrent"]); // it works with magnets and URLs too $response = yield $transmission->removeTorrent(["ids" => [1,2,3,4,/* ...array of torrent IDs */]]); // replace removeTorrent with startTorrent, startTorrentNow, stopTorrent, verifyTorrent, reannounceTorrent $response = yield $transmission->getTorrents([ "fields" => ["array of custom fields, refer to Transmission's RPC documentation"] // or just leave this field blank, so you'll have ALL OF THEM! ]); }); ?>