mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-04-27 04:43:26 +00:00
审查代码,删除无用接口
This commit is contained in:
parent
940f948f43
commit
e01dbfd601
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace IYUU;
|
namespace IYUU;
|
||||||
|
|
||||||
use Curl\Curl;
|
use Curl\Curl;
|
||||||
@ -34,12 +33,8 @@ class AutoReseed
|
|||||||
// API接口配置
|
// API接口配置
|
||||||
public static $apiUrl = 'http://api.iyuu.cn';
|
public static $apiUrl = 'http://api.iyuu.cn';
|
||||||
public static $endpoints = array(
|
public static $endpoints = array(
|
||||||
'add' => '/api/add',
|
|
||||||
'update' => '/api/update',
|
|
||||||
'reseed' => '/api/reseed',
|
|
||||||
'infohash'=> '/api/infohash',
|
'infohash'=> '/api/infohash',
|
||||||
'sites' => '/api/sites',
|
'sites' => '/api/sites',
|
||||||
'move' => '/api/move',
|
|
||||||
'login' => '/user/login',
|
'login' => '/user/login',
|
||||||
);
|
);
|
||||||
// curl
|
// curl
|
||||||
@ -59,7 +54,6 @@ class AutoReseed
|
|||||||
'reseedSkip' => 0, // 跳过:因未设置passkey,而跳过
|
'reseedSkip' => 0, // 跳过:因未设置passkey,而跳过
|
||||||
'reseedPass' => 0, // 忽略:因上次成功添加、存在缓存,而跳过
|
'reseedPass' => 0, // 忽略:因上次成功添加、存在缓存,而跳过
|
||||||
);
|
);
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
@ -82,7 +76,6 @@ class AutoReseed
|
|||||||
// 合作站点自动注册鉴权
|
// 合作站点自动注册鉴权
|
||||||
Oauth::login(self::$apiUrl . self::$endpoints['login']);
|
Oauth::login(self::$apiUrl . self::$endpoints['login']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示支持站点列表
|
* 显示支持站点列表
|
||||||
*/
|
*/
|
||||||
@ -116,7 +109,7 @@ class AutoReseed
|
|||||||
die('远端服务器无响应,请稍后再试!!!');
|
die('远端服务器无响应,请稍后再试!!!');
|
||||||
}
|
}
|
||||||
$data = [];
|
$data = [];
|
||||||
$i = $j = $k = 0;
|
$i = $j = $k = 0; // i列、j序号、k行
|
||||||
foreach ($sites as $v) {
|
foreach ($sites as $v) {
|
||||||
// 控制多少列
|
// 控制多少列
|
||||||
if ($i > 4) {
|
if ($i > 4) {
|
||||||
@ -146,13 +139,14 @@ class AutoReseed
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
// 传入配置,创建客户端实例
|
||||||
$client = AbstractClient::create($v);
|
$client = AbstractClient::create($v);
|
||||||
self::$links[$k]['BT_backup'] = isset($v['BT_backup']) && $v['BT_backup'] ? $v['BT_backup'] : '';
|
|
||||||
self::$links[$k]['type'] = $v['type'];
|
|
||||||
self::$links[$k]['rpc'] = $client;
|
self::$links[$k]['rpc'] = $client;
|
||||||
|
self::$links[$k]['type'] = $v['type'];
|
||||||
|
self::$links[$k]['BT_backup'] = isset($v['BT_backup']) && $v['BT_backup'] ? $v['BT_backup'] : '';
|
||||||
$result = $client->status();
|
$result = $client->status();
|
||||||
print $v['type'].':'.$v['host']." Rpc连接 [{$result}] \n";
|
print $v['type'].':'.$v['host']." Rpc连接 [{$result}] \n";
|
||||||
// 检查是否转移种子的做种客户端?
|
// 检查转移做种
|
||||||
if (isset($v['move']) && $v['move'] && is_null(self::$move)) {
|
if (isset($v['move']) && $v['move'] && is_null(self::$move)) {
|
||||||
self::$move = array($k,$v['move']);
|
self::$move = array($k,$v['move']);
|
||||||
}
|
}
|
||||||
@ -161,7 +155,6 @@ class AutoReseed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 添加下载任务
|
* @brief 添加下载任务
|
||||||
* @param string $torrent 种子元数据
|
* @param string $torrent 种子元数据
|
||||||
@ -241,7 +234,7 @@ class AutoReseed
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 提交种子hash给远端API,用来获取辅种数据
|
* 转移、辅种总入口
|
||||||
*/
|
*/
|
||||||
public static function call()
|
public static function call()
|
||||||
{
|
{
|
||||||
@ -276,17 +269,17 @@ class AutoReseed
|
|||||||
if (empty($hashArray)) {
|
if (empty($hashArray)) {
|
||||||
// 失败
|
// 失败
|
||||||
continue;
|
continue;
|
||||||
} else {
|
|
||||||
$infohash_Dir = $hashArray['hashString'];
|
|
||||||
unset($hashArray['hashString']);
|
|
||||||
// 签名
|
|
||||||
$hashArray['sign'] = Oauth::getSign();
|
|
||||||
$hashArray['timestamp'] = time();
|
|
||||||
$hashArray['version'] = self::VER;
|
|
||||||
// 写请求日志
|
|
||||||
wlog($hashArray, 'hashString'.$k);
|
|
||||||
self::$wechatMsg['hashCount'] +=count($infohash_Dir);
|
|
||||||
}
|
}
|
||||||
|
// 此处需要优化大于一万条做种时,应分批上传
|
||||||
|
$infohash_Dir = $hashArray['hashString'];
|
||||||
|
unset($hashArray['hashString']);
|
||||||
|
// 签名
|
||||||
|
$hashArray['sign'] = Oauth::getSign();
|
||||||
|
$hashArray['timestamp'] = time();
|
||||||
|
$hashArray['version'] = self::VER;
|
||||||
|
// 写请求日志
|
||||||
|
wlog($hashArray, 'hashString'.$k);
|
||||||
|
self::$wechatMsg['hashCount'] +=count($infohash_Dir);
|
||||||
echo "正在向服务器提交 clients_".$k." 种子哈希……".PHP_EOL;
|
echo "正在向服务器提交 clients_".$k." 种子哈希……".PHP_EOL;
|
||||||
$res = self::$curl->post(self::$apiUrl . self::$endpoints['infohash'], $hashArray);
|
$res = self::$curl->post(self::$apiUrl . self::$endpoints['infohash'], $hashArray);
|
||||||
$res = json_decode($res->response, true);
|
$res = json_decode($res->response, true);
|
||||||
@ -577,11 +570,11 @@ class AutoReseed
|
|||||||
$rpcKey = self::$move[0];
|
$rpcKey = self::$move[0];
|
||||||
$type = self::$links[$rpcKey]['type'];
|
$type = self::$links[$rpcKey]['type'];
|
||||||
if ($type == 'qBittorrent') {
|
if ($type == 'qBittorrent') {
|
||||||
$extra_options['skip_checking'] = "true"; //转移时,跳校验
|
#$extra_options['skip_checking'] = "true"; //转移时,跳校验
|
||||||
} else {
|
} else {
|
||||||
$extra_options = array();
|
$extra_options = array();
|
||||||
}
|
}
|
||||||
// 成功返回:true
|
// 添加转移任务:成功返回:true
|
||||||
$ret = self::add(self::$move[0], $torrent, $downloadDir, $extra_options);
|
$ret = self::add(self::$move[0], $torrent, $downloadDir, $extra_options);
|
||||||
/**
|
/**
|
||||||
* 转移成功的种子写日志
|
* 转移成功的种子写日志
|
||||||
|
@ -421,7 +421,7 @@ function ShowTableSites($dir = 'Protocols', $filter = array())
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$data = [];
|
$data = [];
|
||||||
$i = $j = $k = 0;
|
$i = $j = $k = 0; //i列、j序号、k行
|
||||||
foreach (glob(APP_PATH.$dir.DS.'*.php') as $key => $start_file) {
|
foreach (glob(APP_PATH.$dir.DS.'*.php') as $key => $start_file) {
|
||||||
$start_file = str_replace("\\", "/", $start_file);
|
$start_file = str_replace("\\", "/", $start_file);
|
||||||
$offset = strripos($start_file, '/');
|
$offset = strripos($start_file, '/');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user