使用php-cs-fixer更新代码格式

master
Rhilip 5 years ago
parent 7a41449855
commit 7315524056
  1. 2
      .gitignore
  2. 431
      app/Class/Function.php
  3. 543
      app/Class/IFile.php
  4. 23
      app/Class/Oauth.php
  5. 607
      app/Class/Rpc.php
  6. 1240
      app/Class/TransmissionRPC.php
  7. 29
      app/Class/qBittorrent.php
  8. 91
      app/Class/uTorrent.php
  9. 572
      app/config/config.sample.php

2
.gitignore vendored

@ -3,4 +3,4 @@
/php-7.2.12-nts /php-7.2.12-nts
/*.bat /*.bat
/*.sh /*.sh
/vendor /vendor

@ -2,23 +2,24 @@
/** /**
* 调试函数 * 调试函数
*/ */
function p($data, $echo=true){ function p($data, $echo=true)
$str='******************************'."\n"; {
// 如果是boolean或者null直接显示文字;否则print $str='******************************'."\n";
if (is_bool($data)) { // 如果是boolean或者null直接显示文字;否则print
$show_data=$data ? 'true' : 'false'; if (is_bool($data)) {
}elseif (is_null($data)) { $show_data=$data ? 'true' : 'false';
$show_data='null'; } elseif (is_null($data)) {
}else{ $show_data='null';
$show_data=print_r($data,true); } else {
} $show_data=print_r($data, true);
$str.=$show_data; }
$str.="\n".'******************************'."\n"; $str.=$show_data;
if($echo){ $str.="\n".'******************************'."\n";
echo $str; if ($echo) {
return null; echo $str;
} return null;
return $str; }
return $str;
} }
/** /**
@ -26,21 +27,21 @@ function p($data, $echo=true){
*/ */
function sc($text='', $desp='') function sc($text='', $desp='')
{ {
global $configALL; global $configALL;
$token = $configALL['sc.ftqq.com']; $token = $configALL['sc.ftqq.com'];
$desp = ($desp=='')?date("Y-m-d H:i:s") :$desp; $desp = ($desp=='')?date("Y-m-d H:i:s") :$desp;
$postdata = http_build_query(array( $postdata = http_build_query(array(
'text' => $text, 'text' => $text,
'desp' => $desp 'desp' => $desp
)); ));
$opts = array('http' => array( $opts = array('http' => array(
'method' => 'POST', 'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded', 'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata 'content' => $postdata
)); ));
$context = stream_context_create($opts); $context = stream_context_create($opts);
$result = file_get_contents('http://sc.ftqq.com/'.$token.'.send', false, $context); $result = file_get_contents('http://sc.ftqq.com/'.$token.'.send', false, $context);
return $result; return $result;
} }
/** /**
@ -48,72 +49,72 @@ function sc($text='', $desp='')
*/ */
function ff($text='', $desp='') function ff($text='', $desp='')
{ {
global $configALL; global $configALL;
$token = $configALL['iyuu.cn']; $token = $configALL['iyuu.cn'];
$desp = ($desp=='')?date("Y-m-d H:i:s") :$desp; $desp = ($desp=='')?date("Y-m-d H:i:s") :$desp;
$postdata = http_build_query(array( $postdata = http_build_query(array(
'text' => $text, 'text' => $text,
'desp' => $desp 'desp' => $desp
)); ));
$opts = array('http' => array( $opts = array('http' => array(
'method' => 'POST', 'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded', 'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata 'content' => $postdata
)); ));
$context = stream_context_create($opts); $context = stream_context_create($opts);
$result = file_get_contents('http://iyuu.cn/'.$token.'.send', false, $context); $result = file_get_contents('http://iyuu.cn/'.$token.'.send', false, $context);
return $result; return $result;
} }
/** /**
* 微信推送 爱语飞飞 * 微信推送 爱语飞飞
* @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] => 匿名
) )
*/ */
function send($site = '', $torrent = array()) function send($site = '', $torrent = array())
{ {
$br = "\r\n"; $br = "\r\n";
$text = $site. ' 免费:' .$torrent['filename']. ',添加成功'; $text = $site. ' 免费:' .$torrent['filename']. ',添加成功';
$desp = '主标题:'.$torrent['h1'] . $br; $desp = '主标题:'.$torrent['h1'] . $br;
if ( isset($torrent['title']) ) { if (isset($torrent['title'])) {
$desp .= '副标题:'.$torrent['title']. $br; $desp .= '副标题:'.$torrent['title']. $br;
} }
if ( isset($torrent['size']) ) { if (isset($torrent['size'])) {
$desp .= '大小:'.$torrent['size']. $br; $desp .= '大小:'.$torrent['size']. $br;
} }
if ( isset($torrent['seeders']) ) { if (isset($torrent['seeders'])) {
$desp .= '做种数:'.$torrent['seeders']. $br; $desp .= '做种数:'.$torrent['seeders']. $br;
} }
if ( isset($torrent['leechers']) ) { if (isset($torrent['leechers'])) {
$desp .= '下载数:'.$torrent['leechers']. $br; $desp .= '下载数:'.$torrent['leechers']. $br;
} }
if ( isset($torrent['owner']) ) { if (isset($torrent['owner'])) {
$desp .= '发布者:'.$torrent['owner']. $br; $desp .= '发布者:'.$torrent['owner']. $br;
} }
return ff($text, $desp); return ff($text, $desp);
} }
/** /**
@ -124,34 +125,34 @@ function send($site = '', $torrent = array())
*/ */
function download($url, $cookies, $useragent, $method = 'GET') function download($url, $cookies, $useragent, $method = 'GET')
{ {
$header = array( $header = array(
"Content-Type:application/x-www-form-urlencoded", "Content-Type:application/x-www-form-urlencoded",
'User-Agent: '.$useragent); 'User-Agent: '.$useragent);
$ch = curl_init(); $ch = curl_init();
if($method === 'POST'){ if ($method === 'POST') {
curl_setopt($ch, CURLOPT_POST, true ); curl_setopt($ch, CURLOPT_POST, true);
} }
if(stripos($url, 'https://') !== FALSE) { if (stripos($url, 'https://') !== false) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSLVERSION, 1); curl_setopt($ch, CURLOPT_SSLVERSION, 1);
} }
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER,$header); curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_COOKIE,$cookies); curl_setopt($ch, CURLOPT_COOKIE, $cookies);
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,60); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT,600); curl_setopt($ch, CURLOPT_TIMEOUT, 600);
$data = curl_exec($ch); $data = curl_exec($ch);
$status = curl_getinfo($ch); $status = curl_getinfo($ch);
curl_close($ch); curl_close($ch);
if (isset($status['http_code']) && $status['http_code'] == 200) { if (isset($status['http_code']) && $status['http_code'] == 200) {
return $data; return $data;
} }
if (isset($status['http_code']) && $status['http_code'] == 302) { if (isset($status['http_code']) && $status['http_code'] == 302) {
return download($status['redirect_url'], $cookies, $useragent); return download($status['redirect_url'], $cookies, $useragent);
} }
return $data; return $data;
} }
/** /**
@ -159,19 +160,20 @@ function download($url, $cookies, $useragent, $method = 'GET')
* @param string $from 文件大小 * @param string $from 文件大小
* @return int 单位MB * @return int 单位MB
*/ */
function convertToMB($from){ function convertToMB($from)
$number=substr($from,0,-2); {
switch(strtoupper(substr($from,-2))){ $number=substr($from, 0, -2);
switch (strtoupper(substr($from, -2))) {
case "KB": case "KB":
return $number/1024; return $number/1024;
case "MB": case "MB":
return $number; return $number;
case "GB": case "GB":
return $number*pow(1024,1); return $number*pow(1024, 1);
case "TB": case "TB":
return $number*pow(1024,2); return $number*pow(1024, 2);
case "PB": case "PB":
return $number*pow(1024,3); return $number*pow(1024, 3);
default: default:
return $from; return $from;
} }
@ -182,91 +184,92 @@ 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())
global $configALL; {
$config = $configALL[$site]; global $configALL;
$filter = array(); $config = $configALL[$site];
// 读取配置 $filter = array();
if (isset($configALL['default']['filter']) || isset($config['filter'])) { // 读取配置
$filter = isset($config['filter']) && $config['filter'] ? $config['filter'] : $configALL['default']['filter']; if (isset($configALL['default']['filter']) || isset($config['filter'])) {
}else { $filter = isset($config['filter']) && $config['filter'] ? $config['filter'] : $configALL['default']['filter'];
return false; } else {
} return false;
$filename = $torrent['filename']; }
$filename = $torrent['filename'];
// 兼容性 // 兼容性
if ( empty($torrent['size']) ) { if (empty($torrent['size'])) {
return false; return false;
} }
// 大小过滤 // 大小过滤
$size = convertToMB($torrent['size']); $size = convertToMB($torrent['size']);
$min = isset($filter['size']['min']) ? convertToMB($filter['size']['min']) : 0; $min = isset($filter['size']['min']) ? convertToMB($filter['size']['min']) : 0;
$max = isset($filter['size']['max']) ? convertToMB($filter['size']['max']) : 2097152; //默认 2097152MB = 2TB $max = isset($filter['size']['max']) ? convertToMB($filter['size']['max']) : 2097152; //默认 2097152MB = 2TB
if ($min > $size || $size > $max) { if ($min > $size || $size > $max) {
return $filename. ' ' .$size. 'MB,被大小过滤'; return $filename. ' ' .$size. 'MB,被大小过滤';
} }
// 兼容性 // 兼容性
if ( empty($torrent['seeders']) ) { if (empty($torrent['seeders'])) {
return false; return false;
} }
// 种子数过滤 // 种子数过滤
$seeders = $torrent['seeders']; $seeders = $torrent['seeders'];
$min = isset($filter['seeders']['min']) ? $filter['seeders']['min'] : 1; //默认 1 $min = isset($filter['seeders']['min']) ? $filter['seeders']['min'] : 1; //默认 1
$max = isset($filter['seeders']['max']) ? $filter['seeders']['max'] : 3; //默认 3 $max = isset($filter['seeders']['max']) ? $filter['seeders']['max'] : 3; //默认 3
if ($min > $seeders || $seeders > $max) { if ($min > $seeders || $seeders > $max) {
return $filename. ' 当前做种' .$seeders. '人,被过滤'; return $filename. ' 当前做种' .$seeders. '人,被过滤';
} }
// 兼容性 // 兼容性
if ( empty($torrent['leechers']) ) { if (empty($torrent['leechers'])) {
return false; return false;
} }
// 下载数过滤 // 下载数过滤
$leechers = $torrent['leechers']; $leechers = $torrent['leechers'];
$min = isset($filter['leechers']['min']) ? $filter['leechers']['min'] : 0; //默认 $min = isset($filter['leechers']['min']) ? $filter['leechers']['min'] : 0; //默认
$max = isset($filter['leechers']['max']) ? $filter['leechers']['max'] : 30000; //默认 $max = isset($filter['leechers']['max']) ? $filter['leechers']['max'] : 30000; //默认
if ($min > $leechers || $leechers > $max) { if ($min > $leechers || $leechers > $max) {
return $filename. ' 当前下载' .$leechers. '人,被过滤'; return $filename. ' 当前下载' .$leechers. '人,被过滤';
} }
// 兼容性 // 兼容性
if ( empty($torrent['completed']) ) { if (empty($torrent['completed'])) {
return false; return false;
} }
// 完成数过滤 // 完成数过滤
$completed = $torrent['completed']; $completed = $torrent['completed'];
$min = isset($filter['completed']['min']) ? $filter['completed']['min'] : 0; //默认 $min = isset($filter['completed']['min']) ? $filter['completed']['min'] : 0; //默认
$max = isset($filter['completed']['max']) ? $filter['completed']['max'] : 30000; //默认 $max = isset($filter['completed']['max']) ? $filter['completed']['max'] : 30000; //默认
if ($min > $completed || $completed > $max) { if ($min > $completed || $completed > $max) {
return $filename. ' 已完成数' .$completed. '人,被过滤'; return $filename. ' 已完成数' .$completed. '人,被过滤';
} }
return false; return false;
} }
/** /**
@ -284,22 +287,23 @@ function oddFilter($var)
*/ */
function evenFilter($var) function evenFilter($var)
{ {
// 返回$var最后一个二进制位, // 返回$var最后一个二进制位,
// 为0则保留(偶数的二进制的最后一位肯定是0) // 为0则保留(偶数的二进制的最后一位肯定是0)
return(!($var & 1)); return(!($var & 1));
} }
/** /**
* 发布员签名 * 发布员签名
* 注意:同时配置iyuu.cn与secret时,优先使用secret。 * 注意:同时配置iyuu.cn与secret时,优先使用secret。
*/ */
function sign( $timestamp ){ function sign($timestamp)
global $configALL; {
// 爱语飞飞 global $configALL;
$token = isset($configALL['iyuu.cn']) && $configALL['iyuu.cn'] ? $configALL['iyuu.cn'] : ''; // 爱语飞飞
// 鉴权 $token = isset($configALL['iyuu.cn']) && $configALL['iyuu.cn'] ? $configALL['iyuu.cn'] : '';
$token = isset($configALL['secret']) && $configALL['secret'] ? $configALL['secret'] : $token; // 鉴权
return sha1($timestamp . $token); $token = isset($configALL['secret']) && $configALL['secret'] ? $configALL['secret'] : $token;
return sha1($timestamp . $token);
} }
/** /**
@ -307,7 +311,8 @@ function sign( $timestamp ){
* token算法:IYUU + uid + T + sha1(openid+time+盐) * token算法:IYUU + uid + T + sha1(openid+time+盐)
* @param string $token 用户请求token * @param string $token 用户请求token
*/ */
function getUid($token){ function getUid($token)
//验证是否IYUU开头,strpos($token,'T')<15,token总长度小于60(40+10+5) {
return (strlen($token)<60)&&(strpos($token,'IYUU')===0)&&(strpos($token,'T')<15) ? substr($token,4,strpos($token,'T')-4): false; //验证是否IYUU开头,strpos($token,'T')<15,token总长度小于60(40+10+5)
return (strlen($token)<60)&&(strpos($token, 'IYUU')===0)&&(strpos($token, 'T')<15) ? substr($token, 4, strpos($token, 'T')-4): false;
} }

@ -10,323 +10,290 @@
*/ */
class IFile class IFile
{ {
private $resource = null; //文件资源句柄 private $resource = null; //文件资源句柄
/** /**
* @brief 构造函数,打开资源流,并独占锁定 * @brief 构造函数,打开资源流,并独占锁定
* @param String $fileName 文件路径名 * @param String $fileName 文件路径名
* @param String $mode 操作方式,默认为读操作,可供选择的项为:r,r+,w+,w+,a,a+ * @param String $mode 操作方式,默认为读操作,可供选择的项为:r,r+,w+,w+,a,a+
* @note $mod,'r' 只读方式打开,将文件指针指向文件头 * @note $mod,'r' 只读方式打开,将文件指针指向文件头
* 'r+' 读写方式打开,将文件指针指向文件头 * 'r+' 读写方式打开,将文件指针指向文件头
* 'w' 写入方式打开,将文件指针指向文件头并将文件大小截为零。如果文件不存在则尝试创建之。 * 'w' 写入方式打开,将文件指针指向文件头并将文件大小截为零。如果文件不存在则尝试创建之。
* 'w+' 读写方式打开,将文件指针指向文件头并将文件大小截为零。如果文件不存在则尝试创建之。 * 'w+' 读写方式打开,将文件指针指向文件头并将文件大小截为零。如果文件不存在则尝试创建之。
* 'a' 写入方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建之。 * 'a' 写入方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建之。
* 'a+' 读写方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建之。 * 'a+' 读写方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建之。
*/ */
function __construct($fileName,$mode='r') public function __construct($fileName, $mode='r')
{ {
$dirName = dirname($fileName); $dirName = dirname($fileName);
$baseName = basename($fileName); $baseName = basename($fileName);
//检查并创建文件夹
self::mkdir($dirName);
$this->resource = fopen($fileName,$mode.'b'); //检查并创建文件夹
if($this->resource) self::mkdir($dirName);
{
flock($this->resource,LOCK_EX);
}
}
/** $this->resource = fopen($fileName, $mode.'b');
* @brief 获取文件内容 if ($this->resource) {
* @return String 文件内容 flock($this->resource, LOCK_EX);
*/ }
public function read() }
{
$content = null;
while(!feof($this->resource))
{
$content.= fread($this->resource,1024);
}
return $content;
}
/** /**
* @brief 文件写入操作 * @brief 获取文件内容
* @param String $content 要写入的文件内容 * @return String 文件内容
* @return Int or false 写入的字符数; false:写入失败; */
*/ public function read()
public function write($content) {
{ $content = null;
$worldsnum = fwrite($this->resource,$content); while (!feof($this->resource)) {
$this->save(); $content.= fread($this->resource, 1024);
return is_bool($worldsnum) ? false : $worldsnum; }
} return $content;
}
/** /**
* @brief 清空目录下的所有文件 * @brief 文件写入操作
* @return bool false:失败; true:成功; * @param String $content 要写入的文件内容
*/ * @return Int or false 写入的字符数; false:写入失败;
public static function clearDir($dir) */
{ public function write($content)
if($dir[0] != '.' && is_dir($dir) && is_writable($dir)) {
{ $worldsnum = fwrite($this->resource, $content);
$dirRes = opendir($dir); $this->save();
while( false !== ($fileName = readdir($dirRes)) ) return is_bool($worldsnum) ? false : $worldsnum;
{ }
if($fileName[0] !== '.')
{
$fullpath = $dir.'/'.$fileName;
if(is_file($fullpath))
{
self::unlink($fullpath);
}
else
{
self::clearDir($fullpath);
rmdir($fullpath);
}
}
}
closedir($dirRes);
return true;
}
else
{
return false;
}
}
/** /**
* @brief 获取文件信息 * @brief 清空目录下的所有文件
* @param String $fileName 文件路径 * @return bool false:失败; true:成功;
* @return array or null array:文件信息; null:文件不存在; */
*/ public static function clearDir($dir)
public static function getInfo($fileName) {
{ if ($dir[0] != '.' && is_dir($dir) && is_writable($dir)) {
if(is_file($fileName)) $dirRes = opendir($dir);
return stat($fileName); while (false !== ($fileName = readdir($dirRes))) {
if ($fileName[0] !== '.') {
$fullpath = $dir.'/'.$fileName;
if (is_file($fullpath)) {
self::unlink($fullpath);
} else {
self::clearDir($fullpath);
rmdir($fullpath);
}
}
}
closedir($dirRes);
return true;
} else {
return false;
}
}
else /**
return null; * @brief 获取文件信息
} * @param String $fileName 文件路径
* @return array or null array:文件信息; null:文件不存在;
*/
public static function getInfo($fileName)
{
if (is_file($fileName)) {
return stat($fileName);
} else {
return null;
}
}
/** /**
* @brief 创建文件夹 * @brief 创建文件夹
* @param String $path 路径 * @param String $path 路径
* @param int $chmod 文件夹权限 * @param int $chmod 文件夹权限
* @note $chmod 参数不能是字符串(加引号),否则linux会出现权限问题 * @note $chmod 参数不能是字符串(加引号),否则linux会出现权限问题
*/ */
public static function mkdir($path,$chmod=0777) public static function mkdir($path, $chmod=0777)
{ {
return is_dir($path) or (self::mkdir(dirname($path),$chmod) and mkdir($path,$chmod)); return is_dir($path) or (self::mkdir(dirname($path), $chmod) and mkdir($path, $chmod));
} }
/** /**
* @brief 复制文件 * @brief 复制文件
* @param String $from 源文件路径 * @param String $from 源文件路径
* @param String $to 目标文件路径 * @param String $to 目标文件路径
* @param String $mod 操作模式,c:复制(默认); x:剪切(删除$from文件) * @param String $mod 操作模式,c:复制(默认); x:剪切(删除$from文件)
* @return bool 操作结果 true:成功; false:失败; * @return bool 操作结果 true:成功; false:失败;
*/ */
public static function copy($from,$to,$mode = 'c') public static function copy($from, $to, $mode = 'c')
{ {
$dir = dirname($to); $dir = dirname($to);
//创建目录 //创建目录
self::mkdir($dir); self::mkdir($dir);
copy($from,$to); copy($from, $to);
if(is_file($to)) if (is_file($to)) {
{ if ($mode == 'x') {
if($mode == 'x') self::unlink($from);
{ }
self::unlink($from); return true;
} } else {
return true; return false;
} }
else }
{
return false;
}
}
/** /**
* @brief 删除文件 * @brief 删除文件
* @param String $fileName 文件路径 * @param String $fileName 文件路径
* @return bool 操作结果 false:删除失败; * @return bool 操作结果 false:删除失败;
*/ */
public static function unlink($fileName) public static function unlink($fileName)
{ {
if(is_file($fileName) && is_writable($fileName)) if (is_file($fileName) && is_writable($fileName)) {
{ return unlink($fileName);
return unlink($fileName); } else {
} return false;
else }
return false; }
}
/** /**
* @brief 删除$dir文件夹 或者 其下所有文件 * @brief 删除$dir文件夹 或者 其下所有文件
* @param String $dir 文件路径 * @param String $dir 文件路径
* @param bool $recursive 是否强制删除,如果强制删除则递归删除该目录下的全部文件,默认为false * @param bool $recursive 是否强制删除,如果强制删除则递归删除该目录下的全部文件,默认为false
* @return bool true:删除成功; false:删除失败; * @return bool true:删除成功; false:删除失败;
*/ */
public static function rmdir($dir,$recursive = false) public static function rmdir($dir, $recursive = false)
{ {
if(is_dir($dir) && is_writable($dir)) if (is_dir($dir) && is_writable($dir)) {
{ //强制删除
//强制删除 if ($recursive == true) {
if($recursive == true) self::clearDir($dir);
{ return self::rmdir($dir, false);
self::clearDir($dir); }
return self::rmdir($dir,false);
}
//非强制删除 //非强制删除
else else {
{ if (rmdir($dir)) {
if(rmdir($dir)) return true;
{ } else {
return true; return false;
} }
else }
{ }
return false; }
}
}
}
}
/** /**
* @brief 获取文件类型 * @brief 获取文件类型
* @param String $fileName 文件名 * @param String $fileName 文件名
* @return String $filetype 文件类型 * @return String $filetype 文件类型
* @note 如果文件不存在,返回false,如果文件后缀名不在识别列表之内,返回NULL,对于docx及elsx格式文档识别在会出现识别为ZIP格式的错误,这是office2007的bug目前尚未修复,请谨慎使用 * @note 如果文件不存在,返回false,如果文件后缀名不在识别列表之内,返回NULL,对于docx及elsx格式文档识别在会出现识别为ZIP格式的错误,这是office2007的bug目前尚未修复,请谨慎使用
*/ */
public static function getFileType($fileName) public static function getFileType($fileName)
{ {
$filetype = null; $filetype = null;
if(!is_file($fileName)) if (!is_file($fileName)) {
{ return false;
return false; }
}
$fileRes = fopen($fileName,"rb"); $fileRes = fopen($fileName, "rb");
if(!$fileRes) if (!$fileRes) {
{ return false;
return false; }
}
$bin= fread($fileRes, 2); $bin= fread($fileRes, 2);
fclose($fileRes); fclose($fileRes);
if($bin != null) if ($bin != null) {
{ $strInfo = unpack("C2chars", $bin);
$strInfo = unpack("C2chars", $bin); $typeCode = intval($strInfo['chars1'].$strInfo['chars2']);
$typeCode = intval($strInfo['chars1'].$strInfo['chars2']); $typelist = self::getTypeList();
$typelist = self::getTypeList(); foreach ($typelist as $val) {
foreach($typelist as $val) if (strtolower($val[0]) == strtolower($typeCode)) {
{ if ($val[0] == 8075) {
if(strtolower($val[0]) == strtolower($typeCode)) return array('zip','docx','xlsx');
{ } else {
if($val[0] == 8075) return $val[1];
{ }
return array('zip','docx','xlsx'); }
} }
else
{
return $val[1];
}
}
}
} }
return $filetype; return $filetype;
} }
/** /**
* @brief 获取文件类型映射关系 * @brief 获取文件类型映射关系
* @return array 文件类型映射关系数组 * @return array 文件类型映射关系数组
*/ */
public static function getTypeList() public static function getTypeList()
{ {
return array( return array(
array('255216','jpg'), array('255216','jpg'),
array('13780','png'), array('13780','png'),
array('7173','gif'), array('7173','gif'),
array('6677','bmp'), array('6677','bmp'),
array('6063','xml'), array('6063','xml'),
array('60104','html'), array('60104','html'),
array('208207','xls/doc'), array('208207','xls/doc'),
array('8075','zip'), array('8075','zip'),
array('8075','docx'), array('8075','docx'),
array('8075','xlsx'), array('8075','xlsx'),
array("8297","rar"), array("8297","rar"),
); );
} }
/** /**
* @brief 获取文件大小 * @brief 获取文件大小
* @param String $fileName 文件名 * @param String $fileName 文件名
* @return Int 文件大小的字节数,如果文件无效则返回 NULL * @return Int 文件大小的字节数,如果文件无效则返回 NULL
*/ */
public static function getFileSize($fileName) public static function getFileSize($fileName)
{ {
return is_file($fileName) ? filesize($fileName):null; return is_file($fileName) ? filesize($fileName):null;
} }
/** /**
* @brief 检测文件夹是否为空 * @brief 检测文件夹是否为空
* @param String $dir 路径地址 * @param String $dir 路径地址
* @return bool true:$dir为空目录; false:$dir为非空目录; * @return bool true:$dir为空目录; false:$dir为非空目录;
*/ */
public static function isEmptyDir($dir) public static function isEmptyDir($dir)
{ {
if(is_dir($dir)) if (is_dir($dir)) {
{ $isEmpty = true;
$isEmpty = true; $dirRes = opendir($dir);
$dirRes = opendir($dir); while (false !== ($fileName = readdir($dirRes))) {
while(false !== ($fileName = readdir($dirRes))) if ($fileName!='.' && $fileName!='..') {
{ $isEmpty = false;
if($fileName!='.' && $fileName!='..') break;
{ }
$isEmpty = false; }
break; closedir($dirRes);
} return $isEmpty;
} }
closedir($dirRes); }
return $isEmpty;
}
}
/** /**
* @brief 释放文件锁定 * @brief 释放文件锁定
*/ */
public function save() public function save()
{ {
flock($this->resource,LOCK_UN); flock($this->resource, LOCK_UN);
} }
/** /**
* @brief 获取文件扩展名 * @brief 获取文件扩展名
* @param String $fileName 文件名 * @param String $fileName 文件名
* @return String 文件后缀名 * @return String 文件后缀名
*/ */
public static function getFileSuffix($fileName) public static function getFileSuffix($fileName)
{ {
$fileInfoArray = pathinfo($fileName); $fileInfoArray = pathinfo($fileName);
return $fileInfoArray['extension']; return $fileInfoArray['extension'];
} }
/** /**
* @brief 析构函数,释放文件连接句柄 * @brief 析构函数,释放文件连接句柄
*/ */
function __destruct() public function __destruct()
{ {
if(is_resource($this->resource)) if (is_resource($this->resource)) {
{ fclose($this->resource);
fclose($this->resource); }
} }
} }
}

@ -3,7 +3,9 @@
* IYUU用户注册、认证 * IYUU用户注册、认证
*/ */
use Curl\Curl; use Curl\Curl;
class Oauth{
class Oauth
{
// 合作的站点 // 合作的站点
public static $sites = ['ourbits']; public static $sites = ['ourbits'];
// 爱语飞飞token // 爱语飞飞token
@ -17,13 +19,14 @@ class Oauth{
/** /**
* 初始化配置 * 初始化配置
*/ */
public static function init(){ public static function init()
{
global $configALL; global $configALL;
foreach (self::$sites as $name) { foreach (self::$sites as $name) {
if (isset($configALL[$name]['passkey']) && $configALL[$name]['passkey'] && isset($configALL[$name]['id']) && $configALL[$name]['id'] ) { if (isset($configALL[$name]['passkey']) && $configALL[$name]['passkey'] && isset($configALL[$name]['id']) && $configALL[$name]['id']) {
self::$token = self::getSign(); self::$token = self::getSign();
self::$user_id = $configALL[$name]['id']; self::$user_id = $configALL[$name]['id'];
self::$passkey = sha1( $configALL[$name]['passkey'] ); // 避免泄露用户passkey秘钥 self::$passkey = sha1($configALL[$name]['passkey']); // 避免泄露用户passkey秘钥
self::$site = $name; self::$site = $name;
return true; return true;
} }
@ -35,7 +38,8 @@ class Oauth{
/** /**
* 从配置文件内读取爱语飞飞token作为鉴权参数 * 从配置文件内读取爱语飞飞token作为鉴权参数
*/ */
public static function getSign(){ public static function getSign()
{
global $configALL; global $configALL;
// 爱语飞飞 // 爱语飞飞
$token = isset($configALL['iyuu.cn']) && $configALL['iyuu.cn'] ? $configALL['iyuu.cn'] : ''; $token = isset($configALL['iyuu.cn']) && $configALL['iyuu.cn'] ? $configALL['iyuu.cn'] : '';
@ -51,9 +55,10 @@ class Oauth{
* 作用:在服务器端实现微信用户与合作站点用户id的关联 * 作用:在服务器端实现微信用户与合作站点用户id的关联
* 参数:爱语飞飞token + 合作站点用户id + sha1(合作站点密钥passkey) + 合作站点标识 * 参数:爱语飞飞token + 合作站点用户id + sha1(合作站点密钥passkey) + 合作站点标识
*/ */
public static function login($apiUrl = ''){ public static function login($apiUrl = '')
{
$is_oauth = self::init(); $is_oauth = self::init();
if ( $is_oauth ) { if ($is_oauth) {
$curl = new Curl(); $curl = new Curl();
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false); $curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
$data = [ $data = [
@ -66,6 +71,6 @@ class Oauth{
p($res->response); p($res->response);
return true; return true;
} }
return false; return false;
} }
} }

@ -4,78 +4,79 @@
*/ */
class Rpc class Rpc
{ {
/** /**
* 版本号 * 版本号
* @var string * @var string
*/ */
const VER = '0.0.1'; const VER = '0.0.1';
// 下载种子的请求类型 GET POST // 下载种子的请求类型 GET POST
public static $method = 'GET'; public static $method = 'GET';
// RPC连接池 // RPC连接池
public static $links = array(); public static $links = array();
/** /**
* cookie * cookie
*/ */
public static $cookies = ''; public static $cookies = '';
/** /**
* 浏览器 User-Agent * 浏览器 User-Agent
*/ */
public static $userAgent = ''; public static $userAgent = '';
/** /**
* passkey * passkey
*/ */
public static $passkey = ''; public static $passkey = '';
/** /**
* 客户端配置 * 客户端配置
*/ */
public static $clients = ''; public static $clients = '';
/** /**
* 监控目录 * 监控目录
*/ */
public static $watch = ''; public static $watch = '';
/** /**
* 种子存放路径 * 种子存放路径
*/ */
public static $torrentDir = ''; public static $torrentDir = '';
/** /**
* 工作模式 * 工作模式
*/ */
public static $workingMode = ''; public static $workingMode = '';
// 站点标识 // 站点标识
public static $site = ''; public static $site = '';
/** /**
* 负载均衡 控制变量 * 负载均衡 控制变量
*/ */
public static $RPC_Key = 0; public static $RPC_Key = 0;
/** /**
* 退出状态码 * 退出状态码
*/ */
public static $ExitCode = 0; public static $ExitCode = 0;
/** /**
* 初始化 * 初始化
*/ */
public static function init($site = '', $method = 'GET'){ public static function init($site = '', $method = 'GET')
global $configALL; {
global $configALL;
self::$site = $site; self::$site = $site;
self::$method = strtoupper($method); self::$method = strtoupper($method);
$config = $configALL[$site]; $config = $configALL[$site];
self::$cookies = $config['cookie']; self::$cookies = $config['cookie'];
self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent']; self::$userAgent = isset($config['userAgent']) && $config['userAgent'] ? $config['userAgent'] : $configALL['default']['userAgent'];
self::$clients = isset($config['clients']) && $config['clients'] ? $config['clients'] : $configALL['default']['clients']; self::$clients = isset($config['clients']) && $config['clients'] ? $config['clients'] : $configALL['default']['clients'];
self::$workingMode = isset($config['workingMode']) && $config['workingMode'] ? $config['workingMode'] : 0; self::$workingMode = isset($config['workingMode']) && $config['workingMode'] ? $config['workingMode'] : 0;
$watch = isset($config['watch']) && $config['watch'] ? $config['watch'] : $configALL['default']['watch']; $watch = isset($config['watch']) && $config['watch'] ? $config['watch'] : $configALL['default']['watch'];
self::$watch = rtrim($watch,'/') . DS; self::$watch = rtrim($watch, '/') . DS;
self::$torrentDir = TORRENT_PATH . $site . DS; self::$torrentDir = TORRENT_PATH . $site . DS;
// 建立目录 // 建立目录
IFile::mkdir(self::$torrentDir); IFile::mkdir(self::$torrentDir);
self::links(); self::links();
} }
/** /**
* 连接远端RPC服务器 * 连接远端RPC服务器
* *
* @param string * @param string
@ -83,140 +84,138 @@ class Rpc
*/ */
public static function links() public static function links()
{ {
if(self::$workingMode === 1 && empty(self::$links)){ if (self::$workingMode === 1 && empty(self::$links)) {
foreach ( self::$clients as $k => $v ){ foreach (self::$clients as $k => $v) {
// 跳过未配置的客户端 // 跳过未配置的客户端
if (empty($v['username']) || empty( $v['password'])) { if (empty($v['username']) || empty($v['password'])) {
unset(self::$clients[$k]); unset(self::$clients[$k]);
echo "clients_".$k." 用户名或密码未配置,已跳过 \n\n"; echo "clients_".$k." 用户名或密码未配置,已跳过 \n\n";
continue; continue;
} }
try try {
{ switch ($v['type']) {
switch($v['type']){ case 'transmission':
case 'transmission': self::$links[$k]['rpc'] = new TransmissionRPC($v['host'], $v['username'], $v['password']);
self::$links[$k]['rpc'] = new TransmissionRPC($v['host'], $v['username'], $v['password']); $result = self::$links[$k]['rpc']->sstats();
$result = self::$links[$k]['rpc']->sstats(); print $v['type'].':'.$v['host']." Rpc连接成功 [{$result->result}] \n";
print $v['type'].':'.$v['host']." Rpc连接成功 [{$result->result}] \n"; break;
break; case 'qBittorrent':
case 'qBittorrent': self::$links[$k]['rpc'] = new qBittorrent($v['host'], $v['username'], $v['password']);
self::$links[$k]['rpc'] = new qBittorrent($v['host'], $v['username'], $v['password']); $result = self::$links[$k]['rpc']->appVersion();
$result = self::$links[$k]['rpc']->appVersion(); print $v['type'].':'.$v['host']." Rpc连接成功 [{$result}] \n";
print $v['type'].':'.$v['host']." Rpc连接成功 [{$result}] \n"; break;
break; case 'uTorrent':
case 'uTorrent': self::$links[$k]['rpc'] = new uTorrent($v['host'], $v['username'], $v['password']);
self::$links[$k]['rpc'] = new uTorrent($v['host'], $v['username'], $v['password']); $result = self::$links[$k]['rpc']->getBuild();
$result = self::$links[$k]['rpc']->getBuild(); print $v['type'].':'.$v['host']." Rpc连接 [{$result}] \n";
print $v['type'].':'.$v['host']." Rpc连接 [{$result}] \n"; break;
break; default:
default: echo '[ERROR] '.$v['type'];
echo '[ERROR] '.$v['type']; exit(1);
exit(1); break;
break; }
} self::$links[$k]['type'] = $v['type'];
self::$links[$k]['type'] = $v['type']; self::$links[$k]['downloadDir'] = $v['downloadDir'];
self::$links[$k]['downloadDir'] = $v['downloadDir']; } catch (Exception $e) {
} catch (Exception $e) { echo '[ERROR] ' . $e->getMessage() . PHP_EOL;
echo '[ERROR] ' . $e->getMessage() . PHP_EOL; exit(1);
exit(1); }
} }
} }
} return true;
return true;
} }
/** /**
* @brief 添加下载任务 * @brief 添加下载任务
* @param string $torrent 种子元数据 * @param string $torrent 种子元数据
* @param string $save_path 保存路径 * @param string $save_path 保存路径
* @return bool * @return bool
*/ */
public static function add($torrent, $save_path = '', $extra_options = array()) public static function add($torrent, $save_path = '', $extra_options = array())
{ {
switch( (int)self::$workingMode ){ switch ((int)self::$workingMode) {
case 0: // watch默认工作模式 case 0: // watch默认工作模式
// 复制到watch目录 // 复制到watch目录
copy($torrent,$save_path); copy($torrent, $save_path);
if(is_file($save_path)){ if (is_file($save_path)) {
print "********watch模式,下载任务添加成功 \n\n"; print "********watch模式,下载任务添加成功 \n\n";
return true; return true;
}else { } else {
print "-----watch模式,下载任务添加失败!!! \n\n"; print "-----watch模式,下载任务添加失败!!! \n\n";
} }
break; break;
case 1: //负载均衡模式 case 1: //负载均衡模式
try try {
{ $is_url = false;
$is_url = false; if ((strpos($torrent, 'http://')===0) || (strpos($torrent, 'https://')===0) || (strpos($torrent, 'magnet:?xt=urn:btih:')===0)) {
if( (strpos($torrent,'http://')===0) || (strpos($torrent,'https://')===0) || (strpos($torrent,'magnet:?xt=urn:btih:')===0) ){ $is_url = true;
$is_url = true; }
} // 负载均衡
// 负载均衡 $rpcKey = self::$RPC_Key;
$rpcKey = self::$RPC_Key; echo '选中:负载均衡'.$rpcKey."\n";
echo '选中:负载均衡'.$rpcKey."\n"; self::rpcSelect();
self::rpcSelect(); // 调试
// 调试 #p($result);
#p($result); // 下载服务器类型 判断
// 下载服务器类型 判断 $type = self::$links[$rpcKey]['type'];
$type = self::$links[$rpcKey]['type']; switch ($type) {
switch($type){ case 'transmission':
case 'transmission': if ($is_url) {
if( $is_url ){ echo 'add';
echo 'add'; $result = self::$links[$rpcKey]['rpc']->add($torrent, self::$links[$rpcKey]['downloadDir'], $extra_options); // 种子URL添加下载任务
$result = self::$links[$rpcKey]['rpc']->add( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子URL添加下载任务 } else {
}else{ echo 'add_metainfo';
echo 'add_metainfo'; $result = self::$links[$rpcKey]['rpc']->add_metainfo($torrent, self::$links[$rpcKey]['downloadDir'], $extra_options); // 种子文件添加下载任务
$result = self::$links[$rpcKey]['rpc']->add_metainfo( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子文件添加下载任务 }
} $id = $name = '';
$id = $name = ''; if (isset($result->arguments->torrent_duplicate)) {
if( isset($result->arguments->torrent_duplicate) ){ $id = $result->arguments->torrent_duplicate->id;
$id = $result->arguments->torrent_duplicate->id; $name = $result->arguments->torrent_duplicate->name;
$name = $result->arguments->torrent_duplicate->name; } elseif (isset($result->arguments->torrent_added)) {
}elseif( isset($result->arguments->torrent_added) ){ $id = $result->arguments->torrent_added->id;
$id = $result->arguments->torrent_added->id; $name = $result->arguments->torrent_added->name;
$name = $result->arguments->torrent_added->name; }
} if (!$id) {
if(!$id){ print "-----RPC添加种子任务,失败 [{$result->result}] \n\n";
print "-----RPC添加种子任务,失败 [{$result->result}] \n\n"; } else {
}else{ print "********RPC添加下载任务成功 [{$result->result}] (id=$id) \n\n";
print "********RPC添加下载任务成功 [{$result->result}] (id=$id) \n\n"; // 新添加的任务,开始
// 新添加的任务,开始 self::$links[$rpcKey]['rpc']->start($id);
self::$links[$rpcKey]['rpc']->start( $id ); return true;
return true; }
} break;
break; case 'qBittorrent':
case 'qBittorrent': if ($is_url) {
if( $is_url ){ echo 'add';
echo 'add'; $result = self::$links[$rpcKey]['rpc']->add($torrent, self::$links[$rpcKey]['downloadDir'], $extra_options); // 种子URL添加下载任务
$result = self::$links[$rpcKey]['rpc']->add( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子URL添加下载任务 } else {
}else{ echo 'add_metainfo';
echo 'add_metainfo'; $result = self::$links[$rpcKey]['rpc']->add_metainfo($torrent, self::$links[$rpcKey]['downloadDir'], $extra_options); // 种子文件添加下载任务
$result = self::$links[$rpcKey]['rpc']->add_metainfo( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子文件添加下载任务 }
} if ($result === 'Ok.') {
if ($result === 'Ok.') { print "********RPC添加下载任务成功 [{$result}] \n\n";
print "********RPC添加下载任务成功 [{$result}] \n\n"; return true;
return true; } else {
} else { print "-----RPC添加种子任务,失败 [{$result}] \n\n";
print "-----RPC添加种子任务,失败 [{$result}] \n\n"; }
} break;
break; default:
default: echo '[ERROR] '.$type;
echo '[ERROR] '.$type; break;
break; }
} } catch (Exception $e) {
} catch (Exception $e) { die('[ERROR] ' . $e->getMessage() . PHP_EOL);
die('[ERROR] ' . $e->getMessage() . PHP_EOL); }
} break;
break; case 2:
case 2: echo "\n\n";
echo "\n\n"; # 暂未开放
# 暂未开放 break;
break; default:
default: echo "\n\n";
echo "\n\n"; break;
break; }
} return false;
return false;
} }
/** /**
@ -227,142 +226,142 @@ class Rpc
*/ */
public static function rpcSelect() public static function rpcSelect()
{ {
$clientsConut = count(self::$clients); $clientsConut = count(self::$clients);
if( $clientsConut > 1 ){ if ($clientsConut > 1) {
if( $clientsConut > (self::$RPC_Key+1) ){ if ($clientsConut > (self::$RPC_Key+1)) {
self::$RPC_Key++; self::$RPC_Key++;
}else{ } else {
self::$RPC_Key = 0; self::$RPC_Key = 0;
} }
} }
} }
/** /**
* @brief 种子处理函数 * @brief 种子处理函数
* @param array $data 种子数组 * @param array $data 种子数组
* Array * Array
( (
[id] => 118632 [id] => 118632
[h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDxxx [h1] => CCTV5+ 2019 ATP Men's Tennis Final 20191115B HDTV 1080i H264-HDxxx
[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 * @return
*/ */
public static function call($data = array()) public static function call($data = array())
{ {
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
// 控制台打印 // 控制台打印
echo '主标题:'.$value['h1']."\n"; echo '主标题:'.$value['h1']."\n";
echo '副标题:'.$value['title']."\n"; echo '副标题:'.$value['title']."\n";
echo '详情页:'.$value['details']."\n"; echo '详情页:'.$value['details']."\n";
if ( $value['type'] != 0 ) { if ($value['type'] != 0) {
echo "-----非免费,已忽略! \n\n"; echo "-----非免费,已忽略! \n\n";
continue; continue;
} }
if ( isset($value['hr']) && ($value['hr'] == 1) ) { if (isset($value['hr']) && ($value['hr'] == 1)) {
echo "-----HR种子,已忽略! \n\n"; echo "-----HR种子,已忽略! \n\n";
continue; continue;
} }
// 下载任务的可选参数 // 下载任务的可选参数
$extra_options = array(); $extra_options = array();
// 保存的文件名 // 保存的文件名
$filename = $value['id'] . '.torrent'; $filename = $value['id'] . '.torrent';
// 默认watch工作模式,复制到此目录 // 默认watch工作模式,复制到此目录
$to = self::$watch . $filename; $to = self::$watch . $filename;
// 种子完整存放路径 // 种子完整存放路径
$torrentFile = self::$torrentDir . $filename; $torrentFile = self::$torrentDir . $filename;
if(is_file($torrentFile)){ if (is_file($torrentFile)) {
$fileSize = filesize($torrentFile); //失败会返回false 或 0(0代表上次下载失败) $fileSize = filesize($torrentFile); //失败会返回false 或 0(0代表上次下载失败)
if ( !empty($fileSize) ) { if (!empty($fileSize)) {
//种子已经存在 //种子已经存在
echo '-----存在旧种子:'.$filename."\n\n"; echo '-----存在旧种子:'.$filename."\n\n";
continue; continue;
} }
// 删除下载错误的文件 // 删除下载错误的文件
IFile::unlink($torrentFile); IFile::unlink($torrentFile);
} }
// 调用过滤函数 // 调用过滤函数
$isFilter = filter(self::$site, $value); $isFilter = filter(self::$site, $value);
if ( is_string( $isFilter ) ) { if (is_string($isFilter)) {
echo "-----" .$isFilter. "\n\n"; echo "-----" .$isFilter. "\n\n";
continue; continue;
} }
//种子不存在 //种子不存在
echo '正在下载新种子... '.$value['download']." \n"; echo '正在下载新种子... '.$value['download']." \n";
// 创建文件、下载种子以二进制写入 // 创建文件、下载种子以二进制写入
$content = ''; $content = '';
$content = download($value['download'], self::$cookies, self::$userAgent, self::$method); $content = download($value['download'], self::$cookies, self::$userAgent, self::$method);
#p($content); #p($content);
// 文件句柄 // 文件句柄
$resource = fopen($torrentFile, "wb"); $resource = fopen($torrentFile, "wb");
// 成功:返回写入字节数,失败返回false // 成功:返回写入字节数,失败返回false
$worldsnum = fwrite($resource, $content); $worldsnum = fwrite($resource, $content);
// 关闭 // 关闭
fclose($resource); fclose($resource);
// 判断 // 判断
if(is_bool($worldsnum)){ if (is_bool($worldsnum)) {
print "种子下载失败!!! \n\n"; print "种子下载失败!!! \n\n";
IFile::unlink($torrentFile); IFile::unlink($torrentFile);
continue; continue;
}else{ } else {
print "成功下载种子" . $filename . ',共计:' . $worldsnum . "字节 \n"; print "成功下载种子" . $filename . ',共计:' . $worldsnum . "字节 \n";
sleep(mt_rand(2,10)); sleep(mt_rand(2, 10));
$ret = false; $ret = false;
$rpcKey = self::$RPC_Key; $rpcKey = self::$RPC_Key;
switch( (int)self::$workingMode ){ switch ((int)self::$workingMode) {
case 0: //默认工作模式 case 0: //默认工作模式
$ret = self::add($torrentFile, $to); $ret = self::add($torrentFile, $to);
break; break;
case 1: //负载均衡模式 case 1: //负载均衡模式
$type = self::$links[$rpcKey]['type']; $type = self::$links[$rpcKey]['type'];
// 下载服务器类型 // 下载服务器类型
switch ($type) { switch ($type) {
case 'transmission': case 'transmission':
# code... # code...
break; break;
case 'qBittorrent': case 'qBittorrent':
$extra_options['name'] = 'torrents'; $extra_options['name'] = 'torrents';
$extra_options['filename'] = $filename; $extra_options['filename'] = $filename;
$extra_options['autoTMM'] = 'false'; //关闭自动种子管理 $extra_options['autoTMM'] = 'false'; //关闭自动种子管理
break; break;
default: default:
# code... # code...
break; break;
} }
// 种子文件添加下载任务 // 种子文件添加下载任务
$ret = self::add($content, $to, $extra_options); $ret = self::add($content, $to, $extra_options);
break; break;
case 2: case 2:
echo "\n\n"; echo "\n\n";
# 暂未开放 # 暂未开放
break; break;
default: default:
echo "\n\n"; echo "\n\n";
break; break;
} }
global $configALL; global $configALL;
if( isset($configALL['iyuu.cn']) && ($ret === true) ){ if (isset($configALL['iyuu.cn']) && ($ret === true)) {
send(self::$site, $value); send(self::$site, $value);
} }
} }
} }
return true; return true;
} }
} }

File diff suppressed because it is too large Load Diff

@ -1,5 +1,6 @@
<?php <?php
use Curl\Curl; use Curl\Curl;
/** /**
* https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation * https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation
*/ */
@ -35,7 +36,7 @@ class qBittorrent
'1' => null, '1' => null,
'2' => '/api/v2/app/setPreferences' '2' => '/api/v2/app/setPreferences'
], ],
'defaultSavePath' => [ 'defaultSavePath' => [
'1' => null, '1' => null,
'2' => '/api/v2/app/defaultSavePath' '2' => '/api/v2/app/defaultSavePath'
], ],
@ -72,7 +73,7 @@ class qBittorrent
public function __construct($url='', $username='', $password='', $api_version = 2, $debug = false) public function __construct($url='', $username='', $password='', $api_version = 2, $debug = false)
{ {
$this->debug = $debug; $this->debug = $debug;
$this->url = rtrim($url,'/'); $this->url = rtrim($url, '/');
$this->username = $username; $this->username = $username;
$this->password = $password; $this->password = $password;
$this->api_version = $api_version; $this->api_version = $api_version;
@ -130,29 +131,33 @@ class qBittorrent
*/ */
public function add($torrent_url, $save_path = '', $extra_options = array()) public function add($torrent_url, $save_path = '', $extra_options = array())
{ {
if(!empty($save_path)) $extra_options['savepath'] = $save_path; if (!empty($save_path)) {
$extra_options['savepath'] = $save_path;
}
$extra_options['urls'] = $torrent_url; $extra_options['urls'] = $torrent_url;
#$extra_options['skip_checking'] = 'true'; //跳校验 #$extra_options['skip_checking'] = 'true'; //跳校验
// 关键 上传文件流 multipart/form-data【严格按照api文档编写】 // 关键 上传文件流 multipart/form-data【严格按照api文档编写】
$post_data = $this->buildUrls($extra_options); $post_data = $this->buildUrls($extra_options);
#p($post_data); #p($post_data);
// 设置请求头 // 设置请求头
$this->curl->setHeader('Content-Type','multipart/form-data; boundary='.$this->delimiter); $this->curl->setHeader('Content-Type', 'multipart/form-data; boundary='.$this->delimiter);
$this->curl->setHeader('Content-Length',strlen($post_data)); $this->curl->setHeader('Content-Length', strlen($post_data));
return $this->postData('torrent_add', $post_data); return $this->postData('torrent_add', $post_data);
} }
public function add_metainfo($torrent_metainfo, $save_path = '', $extra_options = array()) public function add_metainfo($torrent_metainfo, $save_path = '', $extra_options = array())
{ {
if(!empty($save_path)) $extra_options['savepath'] = $save_path; if (!empty($save_path)) {
$extra_options['savepath'] = $save_path;
}
$extra_options['torrents'] = $torrent_metainfo; $extra_options['torrents'] = $torrent_metainfo;
#$extra_options['skip_checking'] = 'true'; //跳校验 #$extra_options['skip_checking'] = 'true'; //跳校验
// 关键 上传文件流 multipart/form-data【严格按照api文档编写】 // 关键 上传文件流 multipart/form-data【严格按照api文档编写】
$post_data = $this->buildData($extra_options); $post_data = $this->buildData($extra_options);
#p($post_data); #p($post_data);
// 设置请求头 // 设置请求头
$this->curl->setHeader('Content-Type','multipart/form-data; boundary='.$this->delimiter); $this->curl->setHeader('Content-Type', 'multipart/form-data; boundary='.$this->delimiter);
$this->curl->setHeader('Content-Length',strlen($post_data)); $this->curl->setHeader('Content-Length', strlen($post_data));
return $this->postData('torrent_add', $post_data); return $this->postData('torrent_add', $post_data);
} }
@ -250,7 +255,8 @@ class qBittorrent
* 拼接种子urls multipart/form-data * 拼接种子urls multipart/form-data
* https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation#add-new-torrent * https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation#add-new-torrent
*/ */
private function buildUrls($param){ private function buildUrls($param)
{
$this->delimiter = uniqid(); $this->delimiter = uniqid();
$eol = "\r\n"; $eol = "\r\n";
$data = ''; $data = '';
@ -267,7 +273,8 @@ class qBittorrent
* 拼接种子上传文件流 multipart/form-data * 拼接种子上传文件流 multipart/form-data
* https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation#add-new-torrent * https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation#add-new-torrent
*/ */
private function buildData($param){ private function buildData($param)
{
$this->delimiter = uniqid(); $this->delimiter = uniqid();
$eol = "\r\n"; $eol = "\r\n";
$data = ''; $data = '';

@ -29,7 +29,8 @@ define("UTORRENT_STATUS_STARTED", 1);
define("UTORRENT_STATUS_CHECKED", 2); define("UTORRENT_STATUS_CHECKED", 2);
define("UTORRENT_STATUS_START_AFTER_CHECK", 4); define("UTORRENT_STATUS_START_AFTER_CHECK", 4);
class uTorrent { class uTorrent
{
// class static variables // class static variables
private static $base = "%s/gui/%s"; private static $base = "%s/gui/%s";
@ -42,8 +43,9 @@ class uTorrent {
protected $guid; protected $guid;
// constructor // constructor
function __construct($host = "", $user = "", $pass = "") { public function __construct($host = "", $user = "", $pass = "")
$this->host = rtrim($host,'/'); {
$this->host = rtrim($host, '/');
$this->user = $user; $this->user = $user;
$this->pass = $pass; $this->pass = $pass;
@ -54,7 +56,8 @@ class uTorrent {
} }
// performs request // performs request
private function makeRequest($request, $decode = true, $options = array()) { private function makeRequest($request, $decode = true, $options = array())
{
$request = preg_replace('/^\?/', '?token='.$this->token . '&', $request); $request = preg_replace('/^\?/', '?token='.$this->token . '&', $request);
$ch = curl_init(); $ch = curl_init();
@ -71,12 +74,14 @@ class uTorrent {
} }
// implodes given parameter with glue, whether it is an array or not // implodes given parameter with glue, whether it is an array or not
private function paramImplode($glue, $param) { private function paramImplode($glue, $param)
{
return $glue.implode($glue, is_array($param) ? $param : array($param)); return $glue.implode($glue, is_array($param) ? $param : array($param));
} }
// gets token, returns true on success // gets token, returns true on success
private function getToken() { private function getToken()
{
$url = sprintf(self::$base, $this->host, 'token.html'); $url = sprintf(self::$base, $this->host, 'token.html');
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
@ -101,7 +106,8 @@ class uTorrent {
} }
// returns the uTorrent build number // returns the uTorrent build number
public function getBuild(){ public function getBuild()
{
$json = $this->makeRequest("?"); $json = $this->makeRequest("?");
return $json['build']; return $json['build'];
} }
@ -109,13 +115,15 @@ class uTorrent {
// returns an array of files for the specified torrent hash // returns an array of files for the specified torrent hash
// TODO: // TODO:
// - (when implemented in API) allow multiple hashes to be specified // - (when implemented in API) allow multiple hashes to be specified
public function getFiles($hash) { public function getFiles($hash)
{
$json = $this->makeRequest("?action=getfiles&hash=".$hash); $json = $this->makeRequest("?action=getfiles&hash=".$hash);
return $json['files']; return $json['files'];
} }
// returns an array of all labels // returns an array of all labels
public function getLabels(){ public function getLabels()
{
$json = $this->makeRequest("?list=1"); $json = $this->makeRequest("?list=1");
return $json['label']; return $json['label'];
} }
@ -123,19 +131,22 @@ class uTorrent {
// returns an array of the properties for the specified torrent hash // returns an array of the properties for the specified torrent hash
// TODO: // TODO:
// - (when implemented in API) allow multiple hashes to be specified // - (when implemented in API) allow multiple hashes to be specified
public function getProperties($hash) { public function getProperties($hash)
{
$json = $this->makeRequest("?action=getprops&hash=".$hash); $json = $this->makeRequest("?action=getprops&hash=".$hash);
return $json['props']; return $json['props'];
} }
// returns an array of all settings // returns an array of all settings
public function getSettings() { public function getSettings()
{
$json = $this->makeRequest("?action=getsettings"); $json = $this->makeRequest("?action=getsettings");
return $json['settings']; return $json['settings'];
} }
// returns an array of all torrent jobs and related information // returns an array of all torrent jobs and related information
public function getTorrents() { public function getTorrents()
{
$json = $this->makeRequest("?list=1"); $json = $this->makeRequest("?list=1");
return $json['torrents']; return $json['torrents'];
} }
@ -144,7 +155,8 @@ class uTorrent {
* Get all the RSS favourites/filters * Get all the RSS favourites/filters
* @return model\Filter[] * @return model\Filter[]
*/ */
public function getRSSFilters() { public function getRSSFilters()
{
$json = $this->makeRequest("?list=1"); $json = $this->makeRequest("?list=1");
$filters = array(); $filters = array();
foreach ($json['rssfilters'] as $filter) { foreach ($json['rssfilters'] as $filter) {
@ -157,7 +169,8 @@ class uTorrent {
* Update an RSS filter as retrieved from getRSSFilters * Update an RSS filter as retrieved from getRSSFilters
* @param \uTorrent\model\Filter $filter * @param \uTorrent\model\Filter $filter
*/ */
public function setRSSFilter(model\Filter $filter) { public function setRSSFilter(model\Filter $filter)
{
$request = array_merge(array('action' => 'filter-update'), $filter->toParams()); $request = array_merge(array('action' => 'filter-update'), $filter->toParams());
return $this->makeRequest('?'.http_build_query($request)); return $this->makeRequest('?'.http_build_query($request));
} }
@ -168,7 +181,8 @@ class uTorrent {
* @param \uTorrent\model\Filter $filter * @param \uTorrent\model\Filter $filter
* @return int ID of the new filter * @return int ID of the new filter
*/ */
public function addRSSFilter(model\Filter $filter) { public function addRSSFilter(model\Filter $filter)
{
$filter->filterId = -1; $filter->filterId = -1;
$resp = $this->setRSSFilter($filter); $resp = $this->setRSSFilter($filter);
if (!empty($resp['filter_ident'])) { if (!empty($resp['filter_ident'])) {
@ -179,77 +193,90 @@ class uTorrent {
} }
// returns true if WebUI server is online and enabled, false otherwise // returns true if WebUI server is online and enabled, false otherwise
public function is_online() { public function is_online()
{
return is_array($this->makeRequest("?")); return is_array($this->makeRequest("?"));
} }
// sets the properties for the specified torrent hash // sets the properties for the specified torrent hash
// TODO: // TODO:
// - allow multiple hashes, properties, and values to be set simultaneously // - allow multiple hashes, properties, and values to be set simultaneously
public function setProperties($hash, $property, $value) { public function setProperties($hash, $property, $value)
{
$this->makeRequest("?action=setprops&hash=".$hash."&s=".$property."&v=".$value, false); $this->makeRequest("?action=setprops&hash=".$hash."&s=".$property."&v=".$value, false);
} }
// sets the priorities for the specified files in the specified torrent hash // sets the priorities for the specified files in the specified torrent hash
public function setPriority($hash, $files, $priority) { public function setPriority($hash, $files, $priority)
{
$this->makeRequest("?action=setprio&hash=".$hash."&p=".$priority.$this->paramImplode("&f=", $files), false); $this->makeRequest("?action=setprio&hash=".$hash."&p=".$priority.$this->paramImplode("&f=", $files), false);
} }
// sets the settings // sets the settings
// TODO: // TODO:
// - allow multiple settings and values to be set simultaneously // - allow multiple settings and values to be set simultaneously
public function setSetting($setting, $value) { public function setSetting($setting, $value)
{
$this->makeRequest("?action=setsetting&s=".$setting."&v=".$value, false); $this->makeRequest("?action=setsetting&s=".$setting."&v=".$value, false);
} }
// add a file to the list // add a file to the list
public function torrentAdd($filename, &$estring = false) { public function torrentAdd($filename, &$estring = false)
{
$split = explode(":", $filename, 2); $split = explode(":", $filename, 2);
if (count($split) > 1 && (stristr("|http|https|file|magnet|", "|".$split[0]."|") !== false)) { if (count($split) > 1 && (stristr("|http|https|file|magnet|", "|".$split[0]."|") !== false)) {
$this->makeRequest("?action=add-url&s=".urlencode($filename), false); $this->makeRequest("?action=add-url&s=".urlencode($filename), false);
} } elseif (file_exists($filename)) {
elseif (file_exists($filename)) {
$json = $this->makeRequest("?action=add-file", true, array(CURLOPT_POSTFIELDS => array("torrent_file" => "@".realpath($filename)))); $json = $this->makeRequest("?action=add-file", true, array(CURLOPT_POSTFIELDS => array("torrent_file" => "@".realpath($filename))));
if (isset($json['error'])) { if (isset($json['error'])) {
if ($estring !== false) $estring = $json['error']; if ($estring !== false) {
$estring = $json['error'];
}
return false; return false;
} }
return true; return true;
} } else {
else { if ($estring !== false) {
if ($estring !== false) $estring = "File doesn't exist!"; $estring = "File doesn't exist!";
}
return false; return false;
} }
} }
// force start the specified torrent hashes // force start the specified torrent hashes
public function torrentForceStart($hash) { public function torrentForceStart($hash)
{
$this->makeRequest("?action=forcestart".$this->paramImplode("&hash=", $hash), false); $this->makeRequest("?action=forcestart".$this->paramImplode("&hash=", $hash), false);
} }
// pause the specified torrent hashes // pause the specified torrent hashes
public function torrentPause($hash) { public function torrentPause($hash)
{
$this->makeRequest("?action=pause".$this->paramImplode("&hash=", $hash), false); $this->makeRequest("?action=pause".$this->paramImplode("&hash=", $hash), false);
} }
// recheck the specified torrent hashes // recheck the specified torrent hashes
public function torrentRecheck($hash) { public function torrentRecheck($hash)
{
$this->makeRequest("?action=recheck".$this->paramImplode("&hash=", $hash), false); $this->makeRequest("?action=recheck".$this->paramImplode("&hash=", $hash), false);
} }
// start the specified torrent hashes // start the specified torrent hashes
public function torrentStart($hash) { public function torrentStart($hash)
{
$this->makeRequest("?action=start".$this->paramImplode("&hash=", $hash), false); $this->makeRequest("?action=start".$this->paramImplode("&hash=", $hash), false);
} }
// stop the specified torrent hashes // stop the specified torrent hashes
public function torrentStop($hash) { public function torrentStop($hash)
{
$this->makeRequest("?action=stop".$this->paramImplode("&hash=", $hash), false); $this->makeRequest("?action=stop".$this->paramImplode("&hash=", $hash), false);
} }
// remove the specified torrent hashes (and data, if $data is set to true) // remove the specified torrent hashes (and data, if $data is set to true)
public function torrentRemove($hash, $data = false) { public function torrentRemove($hash, $data = false)
{
$this->makeRequest("?action=".($data ? "removedata" : "remove").$this->paramImplode("&hash=", $hash), false); $this->makeRequest("?action=".($data ? "removedata" : "remove").$this->paramImplode("&hash=", $hash), false);
} }
} }

@ -1,352 +1,352 @@
<?php <?php
/** /**
* 技术讨论及后续更新,请加入QQ群!!!!!!! * 技术讨论及后续更新,请加入QQ群!!!!!!!
群名称:IYUU自动辅种交流 群名称:IYUU自动辅种交流
QQ群号:859882209 QQ群号:859882209
* 手动配置方法,请查看:https://www.iyuu.cn/archives/324/ * 手动配置方法,请查看:https://www.iyuu.cn/archives/324/
*/ */
return array( return array(
// 1.爱语飞飞 微信通知配置 // 1.爱语飞飞 微信通知配置
'iyuu.cn' => 'IYUU', 'iyuu.cn' => 'IYUU',
// 2.server酱 微信通知配置 // 2.server酱 微信通知配置
'sc.ftqq.com' => '', 'sc.ftqq.com' => '',
// 3.发布员鉴权 // 3.发布员鉴权
'secret' => '', 'secret' => '',
// 4.全局默认配置 // 4.全局默认配置
'default' => array( 'default' => array(
// 5.【必须配置】浏览器UA,打开http://demo.iyuu.cn 复制过来即可 // 5.【必须配置】浏览器UA,打开http://demo.iyuu.cn 复制过来即可
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36',
// 6.【自动辅种必须配置】全局客户端设置(条目不够可以复制,用不到的请删除) // 6.【自动辅种必须配置】全局客户端设置(条目不够可以复制,用不到的请删除)
'clients' => array( 'clients' => array(
// 全局客户端设置 开始 // 全局客户端设置 开始
array( array(
'type' => 'transmission', // 支持:transmission、qBittorrent 'type' => 'transmission', // 支持:transmission、qBittorrent
'host' => 'http://127.0.0.1:9091/transmission/rpc', 'host' => 'http://127.0.0.1:9091/transmission/rpc',
'username' => '', 'username' => '',
'password' => '', 'password' => '',
//'move' =>array( //'move' =>array(
// 'type' => 2, // 0保持不变,1减,2加, 3直接替换 // 'type' => 2, // 0保持不变,1减,2加, 3直接替换
// 'path' =>array( // 'path' =>array(
// '/sda1' => '/volume1', // '/sda1' => '/volume1',
// ), // ),
//), //),
), ),
// (条目不够可以复制,用不到的请删除) // (条目不够可以复制,用不到的请删除)
array( array(
'type' => 'qBittorrent', // 支持:transmission、qBittorrent 'type' => 'qBittorrent', // 支持:transmission、qBittorrent
'host' => 'http://www.baidu.com:8083', 'host' => 'http://www.baidu.com:8083',
'username' => '', 'username' => '',
'password' => '', 'password' => '',
), ),
// 全局客户端设置 结束 // 全局客户端设置 结束
), ),
'CONNECTTIMEOUT'=> 60, 'CONNECTTIMEOUT'=> 60,
'TIMEOUT' => 600, 'TIMEOUT' => 600,
), ),
/** /**
* 以下为各站点的独立配置(互不影响、互不冲突) * 以下为各站点的独立配置(互不影响、互不冲突)
* 自动辅种:需要配置各站的passkey(没有配置passkey的站点会自动跳过) * 自动辅种:需要配置各站的passkey(没有配置passkey的站点会自动跳过)
*/ */
// m-team 序号:1 // m-team 序号:1
'm-team' => array( 'm-team' => array(
// 14.m-team的cookie 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 14.m-team的cookie 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => 'tp=', 'cookie' => 'tp=',
// 15.m-team的passkey 【必须配置】 // 15.m-team的passkey 【必须配置】
'passkey' => '', 'passkey' => '',
// 种子Tracker的IP地址选择 可选:ipv4,ipv6 // 种子Tracker的IP地址选择 可选:ipv4,ipv6
'ip_type' => 'ipv4', 'ip_type' => 'ipv4',
), ),
// keepfrds 序号:2 // keepfrds 序号:2
'keepfrds' => array( 'keepfrds' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// ourbits 序号:3 // ourbits 序号:3
'ourbits' => array( 'ourbits' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
'id' => 0, // 用户ID 'id' => 0, // 用户ID
'is_vip' => 0, // 是否具有VIP或特殊权限?0 普通,1 VIP 'is_vip' => 0, // 是否具有VIP或特殊权限?0 普通,1 VIP
), ),
// HDSky 序号:4 // HDSky 序号:4
'hdsky' => array( 'hdsky' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// pter 序号:5 // pter 序号:5
'pter' => array( 'pter' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// tjupt 序号:6 // tjupt 序号:6
'tjupt' => array( 'tjupt' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hdhome 序号:7 // hdhome 序号:7
'hdhome' => array( 'hdhome' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// btschool 序号:8 // btschool 序号:8
'btschool' => array( 'btschool' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// PTHome 序号:9 // PTHome 序号:9
'pthome' => array( 'pthome' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hddolby 序号:10 // hddolby 序号:10
'hddolby' => array( 'hddolby' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// TorrentCCF 序号:11 // TorrentCCF 序号:11
'torrentccf' => array( 'torrentccf' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// PTMSG 序号:12 // PTMSG 序号:12
'ptmsg' => array( 'ptmsg' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// MoeCat 序号:13 // MoeCat 序号:13
'moecat' => array( 'moecat' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
// 种子Tracker的IP地址选择 可选:ipv4,ipv6 // 种子Tracker的IP地址选择 可选:ipv4,ipv6
'ip_type' => 'ipv4', 'ip_type' => 'ipv4',
), ),
// totheglory 序号:14 // totheglory 序号:14
'ttg' => array( 'ttg' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// nanyangpt 序号:15 // nanyangpt 序号:15
'nanyangpt' => array( 'nanyangpt' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// springsunday.net 序号:16 // springsunday.net 序号:16
'ssd' => array( 'ssd' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// yingk 序号:17 // yingk 序号:17
'yingk' => array( 'yingk' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hdcity 序号:18 // hdcity 序号:18
'hdcity' => array( 'hdcity' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 cuhash // 如果需要自动辅种,必须配置 cuhash
'passkey' => '', 'passkey' => '',
), ),
// 52pt.site 序号:19 // 52pt.site 序号:19
'52pt' => array( '52pt' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// brobits.cc 序号:20 // brobits.cc 序号:20
'brobits' => array( 'brobits' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// www.beitai.pt 序号:21 // www.beitai.pt 序号:21
'beitai' => array( 'beitai' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// pt.eastgame.org 序号:22 // pt.eastgame.org 序号:22
'eastgame' => array( 'eastgame' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// pt.soulvoice.club 序号:23 // pt.soulvoice.club 序号:23
'soulvoice' => array( 'soulvoice' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// chdbits 序号:24 // chdbits 序号:24
'chdbits' => array( 'chdbits' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// leaguehd 序号:25 // leaguehd 序号:25
'leaguehd' => array( 'leaguehd' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// ptsbao.club 序号:26 // ptsbao.club 序号:26
'ptsbao' => array( 'ptsbao' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hdchina 序号:27 // hdchina 序号:27
'hdchina' => array( 'hdchina' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hdarea 序号:28 // hdarea 序号:28
'hdarea' => array( 'hdarea' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hdtime 序号:29 // hdtime 序号:29
'hdtime' => array( 'hdtime' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// 1ptba 序号:30 // 1ptba 序号:30
'1ptba' => array( '1ptba' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hd4fans 序号:31 // hd4fans 序号:31
'hd4fans' => array( 'hd4fans' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hdbug 序号:32 // hdbug 序号:32
'hdbug' => array( 'hdbug' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// opencd 序号:33 // opencd 序号:33
'opencd' => array( 'opencd' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hdstreet 序号:34 // hdstreet 序号:34
'hdstreet' => array( 'hdstreet' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// joyhd 序号:35 // joyhd 序号:35
'joyhd' => array( 'joyhd' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// dmhy 序号:36 // dmhy 序号:36
'dmhy' => array( 'dmhy' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// upxin 序号:37 // upxin 序号:37
'upxin' => array( 'upxin' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// oshen 序号:38 // oshen 序号:38
'oshen' => array( 'oshen' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// discfan 序号:39 // discfan 序号:39
'discfan' => array( 'discfan' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// hdzone 序号:40 // hdzone 序号:40
'hdzone' => array( 'hdzone' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// cnscg 序号:41 // cnscg 序号:41
'cnscg' => array( 'cnscg' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// nicept 序号:42 // nicept 序号:42
'nicept' => array( 'nicept' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// 配置文件结束 // 配置文件结束
); );

Loading…
Cancel
Save