合并代码,优化hash缓存日志信息。

This commit is contained in:
iyuu.cn
2020-01-17 19:46:46 +08:00
parent 9615f177d0
commit f260065fb9
2 changed files with 62 additions and 59 deletions

View File

@ -20,17 +20,17 @@ class AutoReseed
* 版本号 * 版本号
* @var string * @var string
*/ */
const VER = '20191224.1010'; const VER = '0.2.0';
/** /**
* RPC连接池 * RPC连接池
* @var array * @var array
*/ */
public static $links = array(); public static $links = [];
/** /**
* 客户端配置 * 客户端配置
* @var array * @var array
*/ */
public static $clients = array(); public static $clients = [];
/** /**
* 不辅种的站点 'ourbits','hdchina' * 不辅种的站点 'ourbits','hdchina'
* @var array * @var array
@ -206,7 +206,6 @@ class AutoReseed
echo "未获取到需要辅种的数据,请多多保种,然后重试! \n"; echo "未获取到需要辅种的数据,请多多保种,然后重试! \n";
break; break;
} }
#p($res);exit;
// 过滤,只保留正常做种 // 过滤,只保留正常做种
$res = array_filter($res, "qbfilterStatus"); $res = array_filter($res, "qbfilterStatus");
// 提取数组hashString // 提取数组hashString
@ -453,19 +452,13 @@ class AutoReseed
case 'ttg': case 'ttg':
$url = $_url."/". $configALL[$sites[$sitesID]['site']]['passkey']; $url = $_url."/". $configALL[$sites[$sitesID]['site']]['passkey'];
break; break;
case 'm-team': case 'm-team':
case 'moecat':
$ip_type = ''; $ip_type = '';
if (isset($configALL[$sites[$sitesID]['site']]['ip_type'])) { if (isset($configALL[$sites[$sitesID]['site']]['ip_type'])) {
$ip_type = $configALL[$sites[$sitesID]['site']]['ip_type'] == 'ipv6' ? '&ipv6=1' : ''; $ip_type = $configALL[$sites[$sitesID]['site']]['ip_type'] == 'ipv6' ? '&ipv6=1' : '';
} }
$url = $_url."&passkey=". $configALL[$sites[$sitesID]['site']]['passkey'] . $ip_type. "&https=1"; $url = $_url."&passkey=". $configALL[$sites[$sitesID]['site']]['passkey'] . $ip_type. "&https=1";
break;
case 'moecat':
$ip_type = '';
if (isset($configALL[$sites[$sitesID]['site']]['ip_type'])) {
$ip_type = $configALL[$sites[$sitesID]['site']]['ip_type'] == 'ipv6' ? '&ipv6=1' : '';
}
$url = $_url."&passkey=". $configALL[$sites[$sitesID]['site']]['passkey'] . $ip_type. "&https=1";
break; break;
default: default:
$url = $_url."&passkey=". $configALL[$sites[$sitesID]['site']]['passkey']; $url = $_url."&passkey=". $configALL[$sites[$sitesID]['site']]['passkey'];
@ -501,7 +494,7 @@ class AutoReseed
$url = download($_url, $cookie, $userAgent); $url = download($_url, $cookie, $userAgent);
if(strpos($url,'系统检测到过多的种子下载请求') != false){ if(strpos($url,'系统检测到过多的种子下载请求') != false){
echo "当前站点触发人机验证,已加入排除列表 \n"; echo "当前站点触发人机验证,已加入排除列表 \n";
ff($sites[$sitesID]['site']. ' 触发人机验证,请重新设置'); ff($sites[$sitesID]['site']. '站点,辅种时触发人机验证');
$configALL[$sites[$sitesID]['site']]['limit'] = 1; $configALL[$sites[$sitesID]['site']]['limit'] = 1;
self::$noReseed[] = 'hdchina'; self::$noReseed[] = 'hdchina';
} }
@ -536,7 +529,17 @@ class AutoReseed
$ret = self::add($k, $url, $downloadDir); $ret = self::add($k, $url, $downloadDir);
// 添加成功的种子以infohash为文件名写入缓存 // 添加成功的种子以infohash为文件名写入缓存
if ($ret) { if ($ret) {
// 成功的种子 // 成功的种子
switch ($sites[$sitesID]['site']) {
case 'hdchina':
$url = $details_url;
break;
case 'hdcity':
$url = $_url;
break;
default:
break;
}
// 文件句柄 // 文件句柄
$resource = fopen(self::$cacheHash . $value['info_hash'].'.txt', "wb"); $resource = fopen(self::$cacheHash . $value['info_hash'].'.txt', "wb");
// 成功返回写入字节数失败返回false // 成功返回写入字节数失败返回false

View File

@ -80,28 +80,28 @@ function ff($text='', $desp='')
* @param string $site * @param string $site
* @param array $torrent 种子数组 * @param array $torrent 种子数组
* Array * Array
* ( (
* [id] => 118632 [id] => 118632
* [h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDSTV [h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDSTV
* [title] => 央视体育赛事频道 2019年ATP男子网球年终总决赛 单打小组赛 纳达尔VS西西帕斯 20191115[优惠剩余时间4时13分] [title] => 央视体育赛事频道 2019年ATP男子网球年终总决赛 单打小组赛 纳达尔VS西西帕斯 20191115[优惠剩余时间4时13分]
* [details] => https://xxx.me/details.php?id=118632 [details] => https://xxx.me/details.php?id=118632
* [download] => https://xxx.me/download.php?id=118632 [download] => https://xxx.me/download.php?id=118632
* [filename] => 118632.torrent [filename] => 118632.torrent
* [type] => 0 [type] => 0
* [sticky] => 1 [sticky] => 1
* [time] => Array [time] => Array
* ( (
* [0] => "2019-11-16 20:41:53">4时13分 [0] => "2019-11-16 20:41:53">4时13分
* [1] => "2019-11-16 14:41:53">1时<br />46分 [1] => "2019-11-16 14:41:53">1时<br />46分
* ) )
* [comments] => 0 [comments] => 0
* [size] => 5232.64MB [size] => 5232.64MB
* [seeders] => 69 [seeders] => 69
* [leechers] => 10 [leechers] => 10
* [completed] => 93 [completed] => 93
* [percentage] => 100% [percentage] => 100%
* [owner] => 匿名 [owner] => 匿名
* ) )
* @return false|string * @return false|string
*/ */
function send($site = '', $torrent = array()) function send($site = '', $torrent = array())
@ -197,28 +197,28 @@ function convertToMB($from)
* @param string $site 站点标识 * @param string $site 站点标识
* @param array $torrent 种子数组 * @param array $torrent 种子数组
* Array * Array
( (
[id] => 118632 [id] => 118632
[h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDSTV [h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDSTV
[title] => 央视体育赛事频道 2019年ATP男子网球年终总决赛 单打小组赛 纳达尔VS西西帕斯 20191115[优惠剩余时间4时13分] [title] => 央视体育赛事频道 2019年ATP男子网球年终总决赛 单打小组赛 纳达尔VS西西帕斯 20191115[优惠剩余时间4时13分]
[details] => https://xxx.me/details.php?id=118632 [details] => https://xxx.me/details.php?id=118632
[download] => https://xxx.me/download.php?id=118632 [download] => https://xxx.me/download.php?id=118632
[filename] => 118632.torrent [filename] => 118632.torrent
[type] => 0 [type] => 0
[sticky] => 1 [sticky] => 1
[time] => Array [time] => Array
( (
[0] => "2019-11-16 20:41:53">4时13分 [0] => "2019-11-16 20:41:53">4时13分
[1] => "2019-11-16 14:41:53">1时<br />46分 [1] => "2019-11-16 14:41:53">1时<br />46分
) )
[comments] => 0 [comments] => 0
[size] => 5232.64MB [size] => 5232.64MB
[seeders] => 69 [seeders] => 69
[leechers] => 10 [leechers] => 10
[completed] => 93 [completed] => 93
[percentage] => 100% [percentage] => 100%
[owner] => 匿名 [owner] => 匿名
) )
* @return bool 或 string false不过滤 * @return bool 或 string false不过滤
*/ */
function filter($site = '', $torrent = array()) function filter($site = '', $torrent = array())