mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-06-13 04:08:57 +00:00
增加IDE注释
This commit is contained in:
@ -10,4 +10,5 @@ namespace IYUU\Client;
|
|||||||
|
|
||||||
interface AbstractClientInterface
|
interface AbstractClientInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -131,10 +131,40 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
const RPC_LT_14_TR_STATUS_SEED = 8;
|
const RPC_LT_14_TR_STATUS_SEED = 8;
|
||||||
const RPC_LT_14_TR_STATUS_STOPPED = 16;
|
const RPC_LT_14_TR_STATUS_STOPPED = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes the connection parameters
|
||||||
|
*
|
||||||
|
* TODO: Sanitize username, password, and URL
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
* @param string $username
|
||||||
|
* @param string $password
|
||||||
|
*/
|
||||||
|
public function __construct($url = 'http://localhost:9091/transmission/rpc', $username = null, $password = null, $return_as_array = false)
|
||||||
|
{
|
||||||
|
// server URL
|
||||||
|
$this->url = $url;
|
||||||
|
|
||||||
|
// Username & password
|
||||||
|
$this->username = $username;
|
||||||
|
$this->password = $password;
|
||||||
|
|
||||||
|
// Get the Transmission RPC_version
|
||||||
|
$this->rpc_version = self::sget()->arguments->rpc_version;
|
||||||
|
|
||||||
|
// Return As Array
|
||||||
|
$this->return_as_array = $return_as_array;
|
||||||
|
|
||||||
|
// Reset X-Transmission-Session-Id so we (re)fetch one
|
||||||
|
$this->session_id = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start one or more torrents
|
* Start one or more torrents
|
||||||
*
|
*
|
||||||
* @param int|array ids A list of transmission torrent ids
|
* @param int|array ids A list of transmission torrent ids
|
||||||
|
* @return mixed
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function start($ids)
|
public function start($ids)
|
||||||
{
|
{
|
||||||
@ -149,6 +179,8 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
* Stop one or more torrents
|
* Stop one or more torrents
|
||||||
*
|
*
|
||||||
* @param int|array ids A list of transmission torrent ids
|
* @param int|array ids A list of transmission torrent ids
|
||||||
|
* @return mixed
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function stop($ids)
|
public function stop($ids)
|
||||||
{
|
{
|
||||||
@ -163,6 +195,8 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
* Reannounce one or more torrents
|
* Reannounce one or more torrents
|
||||||
*
|
*
|
||||||
* @param int|array ids A list of transmission torrent ids
|
* @param int|array ids A list of transmission torrent ids
|
||||||
|
* @return mixed
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function reannounce($ids)
|
public function reannounce($ids)
|
||||||
{
|
{
|
||||||
@ -177,6 +211,8 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
* Verify one or more torrents
|
* Verify one or more torrents
|
||||||
*
|
*
|
||||||
* @param int|array ids A list of transmission torrent ids
|
* @param int|array ids A list of transmission torrent ids
|
||||||
|
* @return mixed
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function verify($ids)
|
public function verify($ids)
|
||||||
{
|
{
|
||||||
@ -225,6 +261,8 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
* "result": "success",
|
* "result": "success",
|
||||||
* "tag": 39693
|
* "tag": 39693
|
||||||
* }
|
* }
|
||||||
|
* @return mixed
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function get($ids = array(), $fields = array())
|
public function get($ids = array(), $fields = array())
|
||||||
{
|
{
|
||||||
@ -263,6 +301,8 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
*
|
*
|
||||||
* @param array arguments An associative array of arguments to set
|
* @param array arguments An associative array of arguments to set
|
||||||
* @param int|array ids A list of transmission torrent ids
|
* @param int|array ids A list of transmission torrent ids
|
||||||
|
* @return mixed
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function set($ids = array(), $arguments = array())
|
public function set($ids = array(), $arguments = array())
|
||||||
{
|
{
|
||||||
@ -345,6 +385,8 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
*
|
*
|
||||||
* @param bool delete_local_data Also remove local data?
|
* @param bool delete_local_data Also remove local data?
|
||||||
* @param int|array ids A list of transmission torrent ids
|
* @param int|array ids A list of transmission torrent ids
|
||||||
|
* @return mixed
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function remove($ids, $delete_local_data = false)
|
public function remove($ids, $delete_local_data = false)
|
||||||
{
|
{
|
||||||
@ -364,6 +406,8 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
* @param int|array ids A list of transmission torrent ids
|
* @param int|array ids A list of transmission torrent ids
|
||||||
* @param string target_location The new storage location
|
* @param string target_location The new storage location
|
||||||
* @param string move_existing_data Move existing data or scan new location for available data
|
* @param string move_existing_data Move existing data or scan new location for available data
|
||||||
|
* @return mixed
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function move($ids, $target_location, $move_existing_data = true)
|
public function move($ids, $target_location, $move_existing_data = true)
|
||||||
{
|
{
|
||||||
@ -653,6 +697,7 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
* and store it in $this->session_id
|
* and store it in $this->session_id
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws TransmissionRPCException
|
||||||
*/
|
*/
|
||||||
public function GetSessionID()
|
public function GetSessionID()
|
||||||
{
|
{
|
||||||
@ -713,32 +758,4 @@ class TransmissionRPC implements AbstractClientInterface
|
|||||||
}
|
}
|
||||||
return $this->session_id;
|
return $this->session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Takes the connection parameters
|
|
||||||
*
|
|
||||||
* TODO: Sanitize username, password, and URL
|
|
||||||
*
|
|
||||||
* @param string $url
|
|
||||||
* @param string $username
|
|
||||||
* @param string $password
|
|
||||||
*/
|
|
||||||
public function __construct($url = 'http://localhost:9091/transmission/rpc', $username = null, $password = null, $return_as_array = false)
|
|
||||||
{
|
|
||||||
// server URL
|
|
||||||
$this->url = $url;
|
|
||||||
|
|
||||||
// Username & password
|
|
||||||
$this->username = $username;
|
|
||||||
$this->password = $password;
|
|
||||||
|
|
||||||
// Get the Transmission RPC_version
|
|
||||||
$this->rpc_version = self::sget()->arguments->rpc_version;
|
|
||||||
|
|
||||||
// Return As Array
|
|
||||||
$this->return_as_array = $return_as_array;
|
|
||||||
|
|
||||||
// Reset X-Transmission-Session-Id so we (re)fetch one
|
|
||||||
$this->session_id = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"owner888/phpspider": "^2.1",
|
"ext-curl": "*",
|
||||||
"curl/curl": "^2.2"
|
"owner888/phpspider": "^2.1",
|
||||||
|
"curl/curl": "^2.2"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"IYUU\\": "app/"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"files": ["app/helper.php"]
|
||||||
"psr-4": {
|
}
|
||||||
"IYUU\\": "app/"
|
|
||||||
},
|
|
||||||
"files": ["app/helper.php"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user