Compare commits

..

30 Commits

Author SHA1 Message Date
iyuu.cn
658d764c26 修复pathReplace方法返回值错误 2020-02-08 11:27:10 +08:00
iyuu.cn
2ce1920c51 后端API迁移至新架构,升级版本号到1.0.0 2020-02-07 18:31:51 +08:00
iyuu.cn
ea158ddd55 规范代码 2020-02-01 21:47:26 +08:00
IYUU
76c0cefca2 变更忽略列表 2020-01-31 20:55:27 +08:00
IYUU
a69a2c2955 变更忽略列表 2020-01-31 20:51:52 +08:00
IYUU
7dc0c54c56 排除列表 2020-01-31 20:50:24 +08:00
IYUU
19197d36ce 整合vendor依赖目录 2020-01-31 15:16:18 +08:00
IYUU
8561fac8c4 修改示例配置IP为本机 2020-01-31 12:28:07 +08:00
IYUU
e4911871b8 新增Windows辅种一键脚本 2020-01-31 11:18:00 +08:00
IYUU
a328f68178 完善逻辑 2020-01-31 03:00:32 +08:00
IYUU
ce65b5d1ff 规范换行符 2020-01-31 01:07:18 +08:00
IYUU
dff0c17b33 调整顺序 2020-01-31 00:35:43 +08:00
IYUU
7dcd3e55f4 更新https支持 2020-01-30 22:00:21 +08:00
IYUU
9027262f57 更新文档 2020-01-30 21:52:34 +08:00
IYUU
31d0e6ee03 优化辅种CCFBits下载种子方法。 2020-01-30 17:33:34 +08:00
IYUU
076e688e1c 修复CCFBits自动评论 2020-01-30 16:41:36 +08:00
IYUU
c649c05a3a 新增CCFBits站点支持 2020-01-30 13:57:10 +08:00
IYUU
4896e08635 CCFBits辅种时智能启用评论 2020-01-30 13:22:48 +08:00
IYUU
3b3289274b 完善转移功能:当启用转移功能时,可以设置是否辅种被转移客户端。 2020-01-30 11:33:46 +08:00
IYUU
bf65f7039d 示例配置内增加教程 2020-01-29 15:11:02 +08:00
IYUU
0a7c2120a1 修复str_replace($key, '', $path, 1);执行错误的bug 2020-01-29 14:43:30 +08:00
IYUU
04a10295c2 更新文档 2020-01-29 00:42:52 +08:00
IYUU
3e75aec9d0 减少依赖包 2020-01-29 00:08:58 +08:00
IYUU
63ce263afb 新增做种客户端移动,新增北邮人辅种 2020-01-28 23:57:18 +08:00
iyuu.cn
19df3f3cfb 格式化代码 2020-01-22 22:56:35 +08:00
iyuu.cn
66490efad7 优化错误提示,优化辅种匹配算法 2020-01-22 20:00:21 +08:00
iyuu.cn
9044d3575e 更新参数 2020-01-22 14:19:17 +08:00
iyuu.cn
69ba1ebe56 wiki加入RSS订阅使用教程 2020-01-22 12:10:32 +08:00
iyuu.cn
978295b44d 更新示例配置,支持RSS订阅 2020-01-22 12:05:08 +08:00
iyuu.cn
f3b4deae4c 标准化格式 2020-01-22 10:47:33 +08:00
19 changed files with 819 additions and 341 deletions

4
.gitignore vendored
View File

@@ -1,9 +1,9 @@
/torrent /torrent
/config/config.php /config/config.php
/config/sites.json
/php-7.2.12-nts /php-7.2.12-nts
/*.bat /*.bat
/*.sh /*.sh
/vendor
.idea .idea
.php_cs.cache .php_cs.cache
/config/sites.json vendor

View File

@@ -21,7 +21,7 @@ class AutoReseed
* 版本号 * 版本号
* @var string * @var string
*/ */
const VER = '0.2.0'; const VER = '1.0.0';
/** /**
* RPC连接池 * RPC连接池
* @var array * @var array
@@ -37,6 +37,11 @@ class AutoReseed
* @var array * @var array
*/ */
public static $noReseed = []; public static $noReseed = [];
/**
* 不转移的站点 'hdarea','hdbd'
* @var array
*/
public static $noMove = ['hdarea'];
/** /**
* cookie检查 * cookie检查
* @var array * @var array
@@ -48,25 +53,33 @@ class AutoReseed
*/ */
public static $cacheDir = TORRENT_PATH.'cache'.DS; public static $cacheDir = TORRENT_PATH.'cache'.DS;
public static $cacheHash = TORRENT_PATH.'cachehash'.DS; public static $cacheHash = TORRENT_PATH.'cachehash'.DS;
public static $cacheMove = TORRENT_PATH.'cachemove'.DS;
/** /**
* API接口配置 * API接口配置
* @var string * @var string
* @var array * @var array
*/ */
public static $apiUrl = 'http://iyuu.cn:2122'; public static $apiUrl = 'http://api.iyuu.cn';
public static $endpoints = array( public static $endpoints = array(
'add' => '/api/add', 'add' => '/api/add',
'update' => '/api/update', 'update' => '/api/update',
'reseed' => '/api/reseed', 'reseed' => '/api/reseed',
'login' => '/login', 'infohash'=> '/api/infohash',
'sites' => '/api/sites',
'move' => '/api/move',
'login' => '/user/login',
); );
/**
* curl
*/
public static $curl = null;
/** /**
* 退出状态码 * 退出状态码
* @var int * @var int
*/ */
public static $ExitCode = 0; public static $ExitCode = 0;
/** /**
* 客户端转移做种 状态码[请把transmission配置为第一个客户端] * 客户端转移做种
* @var array * @var array
*/ */
public static $move = null; public static $move = null;
@@ -90,16 +103,20 @@ class AutoReseed
*/ */
public static function init() public static function init()
{ {
global $configALL;
self::$curl = new Curl();
self::$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
self::$curl->setOpt(CURLOPT_SSL_VERIFYHOST, false);
// 显示支持站点列表 // 显示支持站点列表
self::ShowTableSites(); self::ShowTableSites();
global $configALL;
self::$clients = isset($configALL['default']['clients']) && $configALL['default']['clients'] ? $configALL['default']['clients'] : array(); self::$clients = isset($configALL['default']['clients']) && $configALL['default']['clients'] ? $configALL['default']['clients'] : array();
echo "程序正在初始化运行参数... \n"; echo "程序正在初始化运行参数... ".PHP_EOL;
// 递归删除上次历史记录 // 递归删除上次历史记录
IFile::rmdir(self::$cacheDir, true); IFile::rmdir(self::$cacheDir, true);
// 建立目录 // 建立目录
IFile::mkdir(self::$cacheDir); IFile::mkdir(self::$cacheDir);
IFile::mkdir(self::$cacheHash); IFile::mkdir(self::$cacheHash);
IFile::mkdir(self::$cacheMove);
// 连接全局客户端 // 连接全局客户端
self::links(); self::links();
// 合作站点自动注册鉴权 // 合作站点自动注册鉴权
@@ -109,35 +126,37 @@ class AutoReseed
/** /**
* 显示支持站点列表 * 显示支持站点列表
*/ */
private static function ShowTableSites(){ private static function ShowTableSites()
{
$list[] = 'gitee 源码仓库https://gitee.com/ledc/IYUUAutoReseed'; $list[] = 'gitee 源码仓库https://gitee.com/ledc/IYUUAutoReseed';
$list[] = 'github源码仓库https://github.com/ledccn/IYUUAutoReseed'; $list[] = 'github源码仓库https://github.com/ledccn/IYUUAutoReseed';
$list[] = '教程https://gitee.com/ledc/IYUUAutoReseed/tree/master/wiki'; $list[] = '教程https://gitee.com/ledc/IYUUAutoReseed/tree/master/wiki';
$list[] = "QQ群859882209 【IYUU自动辅种交流】 \n"; $list[] = "QQ群859882209 【IYUU自动辅种交流】".PHP_EOL;
foreach ($list as $key => $value) { foreach ($list as $key => $value) {
echo $value.PHP_EOL; echo $value.PHP_EOL;
} }
// 发起请求 echo "正在连接IYUUAutoReseed服务器查询支持列表…… ".PHP_EOL;
echo "正在连接IYUUAutoReseed服务器查询支持列表…… \n"; $res = self::$curl->get(self::$apiUrl.self::$endpoints['sites'].'?sign='.Oauth::getSign());
$curl = new Curl(); $rs = json_decode($res->response, true);
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false); // 禁止验证证书 $sites = isset($rs['data']['sites']) && $rs['data']['sites'] ? $rs['data']['sites'] : false;
$curl->setOpt(CURLOPT_SSL_VERIFYHOST, false); // 不检查证书
$res = $curl->post(self::$apiUrl);
$sites = json_decode($res->response, true);
// 数据写入本地 // 数据写入本地
if (true) { if ($sites) {
$json = array_column($sites, null, 'site'); $json = array_column($sites, null, 'site');
ksort($json); ksort($json);
$json = json_encode($json, JSON_UNESCAPED_UNICODE); $json = json_encode($json, JSON_UNESCAPED_UNICODE);
$myfile = ROOT_PATH.DS.'config'.DS.'sites.json'; $myfile = ROOT_PATH.DS.'config'.DS.'sites.json';
$file_pointer = @fopen($myfile,"w"); $file_pointer = @fopen($myfile, "w");
$worldsnum = @fwrite($file_pointer,$json); $worldsnum = @fwrite($file_pointer, $json);
@fclose($file_pointer); @fclose($file_pointer);
} else {
if (isset($rs['msg']) && $rs['msg']) {
die($rs['msg']);
}
die('远端服务器无响应,请稍后再试!!!');
} }
$data = []; $data = [];
$i = $j = $k = 0; $i = $j = $k = 0;
foreach($sites as $v) foreach ($sites as $v) {
{
// 控制多少列 // 控制多少列
if ($i > 4) { if ($i > 4) {
$k++; $k++;
@@ -151,7 +170,7 @@ class AutoReseed
//输出表格 //输出表格
$table = new Table(); $table = new Table();
$table->setRows($data); $table->setRows($data);
echo($table->render()); echo($table->render());
} }
/** /**
* 连接远端RPC服务器 * 连接远端RPC服务器
@@ -166,7 +185,7 @@ class AutoReseed
// 跳过未配置的客户端 // 跳过未配置的客户端
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." 用户名或密码未配置,已跳过".PHP_EOL.PHP_EOL;
continue; continue;
} }
try { try {
@@ -178,7 +197,7 @@ class AutoReseed
$client = new qBittorrent($v['host'], $v['username'], $v['password']); $client = new qBittorrent($v['host'], $v['username'], $v['password']);
break; break;
default: default:
echo '[ERROR] '.$v['type']; echo '[Links ERROR] '.$v['type'];
exit(1); exit(1);
break; break;
} }
@@ -188,11 +207,11 @@ class AutoReseed
$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']) { if (isset($v['move']) && $v['move'] && is_null(self::$move)) {
self::$move = array($k,$v['type']); self::$move = array($k,$v['move']);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
echo '[ERROR] ' . $e->getMessage() . PHP_EOL; echo '[Links ERROR] ' . $e->getMessage() . PHP_EOL;
exit(1); exit(1);
} }
} }
@@ -219,17 +238,21 @@ class AutoReseed
$result = self::$links[$k]['rpc']->get($ids, $fields); $result = self::$links[$k]['rpc']->get($ids, $fields);
if (empty($result->result) || $result->result != 'success') { if (empty($result->result) || $result->result != 'success') {
// 获取种子列表 失败 // 获取种子列表 失败
echo "获取种子列表失败原因可能是transmission暂时无响应请稍后重试 \n"; echo "获取种子列表失败原因可能是transmission暂时无响应请稍后重试".PHP_EOL;
break; break;
} }
if (empty($result->arguments)) { if (empty($result->arguments->torrents)) {
echo "未获取到需要辅种的数据,请多多保种,然后重试! \n"; echo "未获取到数据,请多多保种,然后重试!".PHP_EOL;
break; break;
} }
// 对象转数组 // 对象转数组
$res = object_array($result->arguments->torrents); $res = object_array($result->arguments->torrents);
// 过滤,只保留正常做种 // 过滤,只保留正常做种
$res = array_filter($res, "filterStatus"); $res = array_filter($res, "filterStatus");
if (empty($res)) {
echo "未获取到需要辅种的数据,请多多保种,然后重试!".PHP_EOL;
break;
}
// 提取数组hashString // 提取数组hashString
$info_hash = array_column($res, 'hashString'); $info_hash = array_column($res, 'hashString');
// 升序排序 // 升序排序
@@ -253,11 +276,15 @@ class AutoReseed
$result = self::$links[$k]['rpc']->torrentList(); $result = self::$links[$k]['rpc']->torrentList();
$res = json_decode($result, true); $res = json_decode($result, true);
if (empty($res)) { if (empty($res)) {
echo "未获取到需要辅种的数据,请多多保种,然后重试! \n"; echo "未获取到数据,请多多保种,然后重试!".PHP_EOL;
break; break;
} }
// 过滤,只保留正常做种 // 过滤,只保留正常做种
$res = array_filter($res, "qbfilterStatus"); $res = array_filter($res, "qbfilterStatus");
if (empty($res)) {
echo "未获取到需要辅种的数据,请多多保种,然后重试!".PHP_EOL;
break;
}
// 提取数组hashString // 提取数组hashString
$info_hash = array_column($res, 'hash'); $info_hash = array_column($res, 'hash');
// 升序排序 // 升序排序
@@ -278,16 +305,12 @@ class AutoReseed
#p(self::$links[$k]['hash']);exit; #p(self::$links[$k]['hash']);exit;
break; break;
default: default:
echo '[ERROR] '.$v['type']; echo '[get ERROR] '.$v['type'] . PHP_EOL;
exit(1); exit(1);
break; break;
} }
// 是否执行转移种子做种客户端?
if (self::$move != null && (empty($v['move']))) {
self::move($res, $v['type']);
}
} catch (\Exception $e) { } catch (\Exception $e) {
echo '[ERROR] ' . $e->getMessage() . PHP_EOL; echo '[get ERROR] ' . $e->getMessage() . PHP_EOL;
exit(1); exit(1);
} }
} }
@@ -326,18 +349,19 @@ class AutoReseed
$id = $result->arguments->torrent_added->id; $id = $result->arguments->torrent_added->id;
$name = $result->arguments->torrent_added->name; $name = $result->arguments->torrent_added->name;
} }
print "********RPC添加下载任务成功 [{$result->result}] (id=$id) \n";
if ($is_url) { if ($is_url) {
print "种子:".$torrent. "\n"; print "种子:".$torrent . PHP_EOL;
} }
print "名字:".$name."\n\n"; print "名字:".$name . PHP_EOL;
print "********RPC添加下载任务成功 [{$result->result}] (id=$id)".PHP_EOL.PHP_EOL;
return true; return true;
} else { } else {
$errmsg = isset($result->result) ? $result->result : '未知错误,请稍后重试!'; $errmsg = isset($result->result) ? $result->result : '未知错误,请稍后重试!';
print "-----RPC添加种子任务失败 [{$errmsg}] \n";
if ($is_url) { if ($is_url) {
print "种子:".$torrent. "\n"; print "种子:".$torrent . PHP_EOL;
} }
print "-----RPC添加种子任务失败 [{$errmsg}]" . PHP_EOL.PHP_EOL;
} }
break; break;
case 'qBittorrent': case 'qBittorrent':
@@ -350,15 +374,18 @@ class AutoReseed
$extra_options['filename'] = rand(1, 4294967200).'.torrent'; $extra_options['filename'] = rand(1, 4294967200).'.torrent';
$result = self::$links[$rpcKey]['rpc']->add_metainfo($torrent, $save_path, $extra_options); // 种子元数据添加下载任务 $result = self::$links[$rpcKey]['rpc']->add_metainfo($torrent, $save_path, $extra_options); // 种子元数据添加下载任务
} }
if ($is_url) {
print "种子:".$torrent.PHP_EOL;
}
if ($result === 'Ok.') { if ($result === 'Ok.') {
print "********RPC添加下载任务成功 [{$result}] \n\n"; print "********RPC添加下载任务成功 [{$result}]".PHP_EOL.PHP_EOL;
return true; return true;
} else { } else {
print "-----RPC添加种子任务失败 [{$result}] \n\n"; print "-----RPC添加种子任务失败 [{$result}]".PHP_EOL.PHP_EOL;
} }
break; break;
default: default:
echo '[ERROR] '.$type; echo '[ERROR] '.$type. PHP_EOL. PHP_EOL;
break; break;
} }
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -366,28 +393,6 @@ class AutoReseed
} }
return false; return false;
} }
/**
* 正常做种的种子在各下载器的互相转移
*/
public static function move($torrent=array(), $type = 'qBittorrent')
{
switch ($type) {
case 'transmission':
break;
case 'qBittorrent':
foreach ($torrent as $k => $v) {
// 路径转换
#$v['save_path'] = '/volume3' . $v['save_path']; // docker路径转换
self::add(self::$move[0], $v['magnet_uri'], $v['save_path']);
}
break;
default:
echo '[ERROR] '.$type;
break;
}
}
/** /**
* @brief 提交种子hash给远端API用来获取辅种数据 * @brief 提交种子hash给远端API用来获取辅种数据
* @param array $hashArray 种子hash数组 * @param array $hashArray 种子hash数组
@@ -395,31 +400,47 @@ class AutoReseed
*/ */
public static function call($hashArray = array()) public static function call($hashArray = array())
{ {
global $configALL; $resArray = array();
$resArray = $sites = array();
$curl = new Curl();
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
// 签名 // 签名
$hashArray['timestamp'] = time();
// 爱语飞飞token
$hashArray['sign'] = Oauth::getSign(); $hashArray['sign'] = Oauth::getSign();
$hashArray['timestamp'] = time();
$hashArray['version'] = self::VER; $hashArray['version'] = self::VER;
// 写请求日志 // 写请求日志
wlog($hashArray,'hashString'); wlog($hashArray, 'hashString');
if (self::$move!==null) {
self::move($hashArray);
}
self::reseed($hashArray);
self::wechatMessage();
}
// 发起请求 /**
echo "正在提交辅种信息…… \n"; * IYUUAutoReseed辅种
$res = $curl->post(self::$apiUrl . self::$endpoints['reseed'], $hashArray); */
$resArray = json_decode($res->response, true); public static function reseed($hashArray = array())
{
global $configALL;
$sites = array();
// 前置过滤
if (self::$move!==null && self::$move[1]==2) {
foreach ($hashArray['hash'] as $key => $json) {
if ($key != 'clients_'.self::$move[0]) {
$hashArray['hash'][$key] = '[]';
}
}
}
echo "正在提交辅种信息……".PHP_EOL;
$res = self::$curl->post(self::$apiUrl . self::$endpoints['reseed'], $hashArray);
$res = json_decode($res->response, true);
$resArray = isset($res['data']) && $res['data'] ? $res['data'] : array();
// 写返回日志 // 写返回日志
wlog($resArray,'reseed'); wlog($res, 'reseed');
// 判断返回值 // 判断返回值
if (isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok')) { if (isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok')) {
echo "辅种信息提交成功!!! \n\n"; echo "辅种信息提交成功!!!".PHP_EOL.PHP_EOL;
} else { } else {
$errmsg = isset($resArray['errmsg']) ? $resArray['errmsg'] : '远端服务器无响应,请稍后重试!'; $errmsg = isset($res['msg']) && $res['msg'] ? $res['msg'] : '远端服务器无响应,请稍后重试!';
echo '-----辅种失败,原因:' .$errmsg. " \n\n"; echo '-----辅种失败,原因:' .$errmsg.PHP_EOL.PHP_EOL;
exit(1); exit(1);
} }
// 可辅种站点信息 // 可辅种站点信息
@@ -429,14 +450,14 @@ class AutoReseed
self::$wechatMsg['sitesCount'] = count($sites); self::$wechatMsg['sitesCount'] = count($sites);
// 按客户端循环辅种 开始 // 按客户端循环辅种 开始
foreach (self::$links as $k => $v) { foreach (self::$links as $k => $v) {
if (empty($resArray['clients_'.$k])) {
echo "clients_".$k."没有查询到可辅种数据".PHP_EOL.PHP_EOL;
continue;
}
$reseed = $infohash_Dir = array(); $reseed = $infohash_Dir = array();
// info_hash与下载目录对应表 // info_hash与下载目录对应表
$infohash_Dir = self::$links[$k]['hash']; $infohash_Dir = self::$links[$k]['hash'];
#p($infohash_Dir); #p($infohash_Dir);
if (empty($resArray['clients_'.$k])) {
echo "clients_".$k."没有查询到可辅种数据 \n\n";
continue;
}
// 当前客户端可辅种数据 // 当前客户端可辅种数据
$reseed = $resArray['clients_'.$k]; $reseed = $resArray['clients_'.$k];
foreach ($reseed as $info_hash => $vv) { foreach ($reseed as $info_hash => $vv) {
@@ -449,86 +470,72 @@ class AutoReseed
self::$wechatMsg['reseedCount']++; self::$wechatMsg['reseedCount']++;
// 站点id // 站点id
$sitesID = $value['sid']; $sitesID = $value['sid'];
// 站点名
$siteName = $sites[$sitesID]['site'];
// 页面规则 // 页面规则
$download_page = str_replace('{}', $value['torrent_id'], $sites[$sitesID]['download_page']); $download_page = str_replace('{}', $value['torrent_id'], $sites[$sitesID]['download_page']);
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$download_page; $_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$download_page;
echo "clients_".$k."正在辅种... {$siteName}".PHP_EOL;
/** /**
* 前置检测 * 前置检测
*/ */
// passkey检测 // passkey检测
if (empty($configALL[$sites[$sitesID]['site']]['passkey'])) { if (empty($configALL[$siteName]['passkey'])) {
echo '-------因当前' .$sites[$sitesID]['site']. "站点未设置passkey已跳过 \n\n"; echo '-------因当前' .$siteName. "站点未设置passkey已跳过".PHP_EOL.PHP_EOL;
self::$wechatMsg['reseedSkip']++; self::$wechatMsg['reseedSkip']++;
continue; continue;
} }
// cookie检测 // cookie检测
if (in_array($sites[$sitesID]['site'], self::$cookieCheck) && empty($configALL[$sites[$sitesID]['site']]['cookie'])) { if (in_array($siteName, self::$cookieCheck) && empty($configALL[$siteName]['cookie'])) {
echo '-------因当前' .$sites[$sitesID]['site']. '站点未设置cookie已跳过' . "\n\n"; echo '-------因当前' .$siteName. '站点未设置cookie已跳过' .PHP_EOL.PHP_EOL;
self::$wechatMsg['reseedSkip']++; self::$wechatMsg['reseedSkip']++;
continue; continue;
} }
// 流控检测 // 流控检测
if (isset($configALL[$sites[$sitesID]['site']]['limit'])) { if (isset($configALL[$siteName]['limit'])) {
echo "-------因当前" .$sites[$sitesID]['site']. "站点触发流控,已跳过!! {$_url} \n\n"; echo "-------因当前" .$siteName. "站点触发流控,已跳过!! {$_url}".PHP_EOL.PHP_EOL;
// 流控日志 // 流控日志
if ($sites[$sitesID]['site'] == 'hdchina') { if ($siteName == 'hdchina') {
$details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1'); $details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1');
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$details_page; $_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$details_page;
} }
wlog('clients_'.$k."\n".$downloadDir."\n"."-------因当前" .$sites[$sitesID]['site']. "站点触发流控,已跳过!! {$_url} \n\n",'reseedLimit'); wlog('clients_'.$k.PHP_EOL.$downloadDir.PHP_EOL."-------因当前" .$siteName. "站点触发流控,已跳过!! {$_url}".PHP_EOL.PHP_EOL, 'reseedLimit');
self::$wechatMsg['reseedSkip']++; self::$wechatMsg['reseedSkip']++;
continue; continue;
} }
// 重复做种检测 // 重复做种检测
if (isset($infohash_Dir[$value['info_hash']])) { if (isset($value['info_hash']) && isset($infohash_Dir[$value['info_hash']])) {
echo '-------与客户端现有种子重复:'.$_url."\n\n"; echo '-------与客户端现有种子重复:'.$_url.PHP_EOL.PHP_EOL;
self::$wechatMsg['reseedRepeat']++; self::$wechatMsg['reseedRepeat']++;
continue; continue;
} }
// 历史添加检测 // 历史添加检测
if (is_file(self::$cacheHash . $value['info_hash'].'.txt')) { if (is_file(self::$cacheHash . $value['info_hash'].'.txt')) {
echo '-------当前种子上次辅种已成功添加,已跳过! '.$_url."\n\n"; echo '-------当前种子上次辅种已成功添加,已跳过! '.$_url.PHP_EOL.PHP_EOL;
self::$wechatMsg['reseedPass']++; self::$wechatMsg['reseedPass']++;
continue; continue;
} }
/** /**
* 种子URL组合方式区分 * 种子URL组合方式区分
*/ */
switch ($sites[$sitesID]['site']) { $url = self::getTorrentUrl($siteName, $_url);
case 'ttg':
$url = $_url."/". $configALL[$sites[$sitesID]['site']]['passkey'];
break;
case 'm-team':
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;
default:
$url = $_url."&passkey=". $configALL[$sites[$sitesID]['site']]['passkey'];
break;
}
/** /**
* 检查站点是否可以辅种 * 检查站点是否可以辅种
*/ */
// 判断是否具有VIP或特殊权限 if ((in_array($siteName, self::$noReseed)==false)) {
$is_vip = isset($configALL[$sites[$sitesID]['site']]['is_vip']) && $configALL[$sites[$sitesID]['site']]['is_vip'] ? 1 : 0;
if ((in_array($sites[$sitesID]['site'], self::$noReseed)==false) || $is_vip) {
/** /**
* 可以辅种 * 可以辅种
*/ */
// 特殊站点:推送给下载器种子元数据 // 特殊站点:推送给下载器种子元数据
switch ($sites[$sitesID]['site']) { switch ($siteName) {
case 'hdchina': case 'hdchina':
$cookie = isset($configALL[$sites[$sitesID]['site']]['cookie']) ? $configALL[$sites[$sitesID]['site']]['cookie'] : ''; $cookie = isset($configALL[$siteName]['cookie']) ? $configALL[$siteName]['cookie'] : '';
$userAgent = $configALL['default']['userAgent']; $userAgent = $configALL['default']['userAgent'];
// 拼接URL // 拼接URL
$details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1'); $details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1');
$details_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$details_page; $details_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$details_page;
$details_html = download($details_url, $cookie, $userAgent); $details_html = download($details_url, $cookie, $userAgent);
print "种子详情页:".$details_url. "\n"; print "种子详情页:".$details_url.PHP_EOL;
// 提取种子下载地址 // 提取种子下载地址
$download_page = str_replace('{}', '', $sites[$sitesID]['download_page']); $download_page = str_replace('{}', '', $sites[$sitesID]['download_page']);
$offset = strpos($details_html, $download_page); $offset = strpos($details_html, $download_page);
@@ -536,20 +543,20 @@ class AutoReseed
// 种子地址 // 种子地址
$_url = substr($urlTemp, 0, strpos($urlTemp, '">')); $_url = substr($urlTemp, 0, strpos($urlTemp, '">'));
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' . $_url; $_url = 'https://' .$sites[$sitesID]['base_url']. '/' . $_url;
print "种子下载页:".$_url. "\n"; print "种子下载页:".$_url.PHP_EOL;
$url = download($_url, $cookie, $userAgent); $url = download($_url, $cookie, $userAgent);
if (strpos($url, '系统检测到过多的种子下载请求') != false) { if (strpos($url, '系统检测到过多的种子下载请求') != false) {
echo "当前站点触发人机验证,已加入排除列表 \n"; echo "当前站点触发人机验证,已加入排除列表".PHP_EOL;
ff($sites[$sitesID]['site']. '站点,辅种时触发人机验证!'); ff($siteName. '站点,辅种时触发人机验证!');
$configALL[$sites[$sitesID]['site']]['limit'] = 1; $configALL[$siteName]['limit'] = 1;
self::$noReseed[] = 'hdchina'; self::$noReseed[] = 'hdchina';
} }
break; break;
case 'hdcity': case 'hdcity':
$cookie = isset($configALL[$sites[$sitesID]['site']]['cookie']) ? $configALL[$sites[$sitesID]['site']]['cookie'] : ''; $cookie = isset($configALL[$siteName]['cookie']) ? $configALL[$siteName]['cookie'] : '';
$userAgent = $configALL['default']['userAgent']; $userAgent = $configALL['default']['userAgent'];
print "种子:".$_url. "\n"; print "种子:".$_url.PHP_EOL;
if (isset($configALL[$sites[$sitesID]['site']]['cuhash'])) { if (isset($configALL[$siteName]['cuhash'])) {
// 已获取cuhash // 已获取cuhash
# code... # code...
} else { } else {
@@ -559,9 +566,9 @@ class AutoReseed
$offset = strpos($html, 'cuhash='); $offset = strpos($html, 'cuhash=');
$len = strlen('cuhash='); $len = strlen('cuhash=');
$cuhashTemp = substr($html, $offset+$len, 40); $cuhashTemp = substr($html, $offset+$len, 40);
$configALL[$sites[$sitesID]['site']]['cuhash'] = substr($cuhashTemp, 0, strpos($cuhashTemp, '"')); $configALL[$siteName]['cuhash'] = substr($cuhashTemp, 0, strpos($cuhashTemp, '"'));
} }
$url = $_url."&cuhash=". $configALL[$sites[$sitesID]['site']]['cuhash']; $url = $_url."&cuhash=". $configALL[$siteName]['cuhash'];
// 城市下载种子时会302转向 // 城市下载种子时会302转向
$url = download($url, $cookie, $userAgent); $url = download($url, $cookie, $userAgent);
break; break;
@@ -573,8 +580,9 @@ class AutoReseed
$ret = false; $ret = false;
// 成功返回true // 成功返回true
$ret = self::add($k, $url, $downloadDir); $ret = self::add($k, $url, $downloadDir);
// 按站点规范日志内容 // 按站点规范日志内容
switch ($sites[$sitesID]['site']) { switch ($siteName) {
case 'hdchina': case 'hdchina':
$url = $details_url; $url = $details_url;
break; break;
@@ -587,14 +595,14 @@ class AutoReseed
// 添加成功的种子以infohash为文件名写入缓存 // 添加成功的种子以infohash为文件名写入缓存
if ($ret) { if ($ret) {
// 成功的种子 // 成功的种子
wlog($url."\n", $value['info_hash'], self::$cacheHash); wlog($url.PHP_EOL, $value['info_hash'], self::$cacheHash);
wlog($url."\n",'reseedSuccess'); wlog($url.PHP_EOL, 'reseedSuccess');
// 成功累加 // 成功累加
self::$wechatMsg['reseedSuccess']++; self::$wechatMsg['reseedSuccess']++;
continue; continue;
} else { } else {
// 失败的种子 // 失败的种子
wlog($url."\n",'reseedError'); wlog($url.PHP_EOL, 'reseedError');
// 失败累加 // 失败累加
self::$wechatMsg['reseedError']++; self::$wechatMsg['reseedError']++;
continue; continue;
@@ -603,9 +611,9 @@ class AutoReseed
/** /**
* 不辅种 * 不辅种
*/ */
echo '-------已跳过不辅种的站点:'.$_url."\n\n"; echo '-------已跳过不辅种的站点:'.$_url.PHP_EOL.PHP_EOL;
// 按站点规范日志内容 // 按站点规范日志内容
switch ($sites[$sitesID]['site']) { switch ($siteName) {
case 'hdchina': case 'hdchina':
$url = $details_url; $url = $details_url;
break; break;
@@ -616,20 +624,301 @@ class AutoReseed
break; break;
} }
// 写入日志文件,供用户手动辅种 // 写入日志文件,供用户手动辅种
wlog('clients_'.$k."\n".$downloadDir."\n".$url."\n".$details_url."\n\n", $sites[$sitesID]['site']); wlog('clients_'.$k.PHP_EOL.$downloadDir.PHP_EOL.$url.PHP_EOL.$details_url.PHP_EOL.PHP_EOL, $siteName);
} }
} }
} }
} }
// 按客户端循环辅种 结束 // 按客户端循环辅种 结束
} }
/** /**
* * IYUUAutoReseed做种客户端转移
*/
public static function move($hashArray = array())
{
global $configALL;
$sites = array();
// 前置过滤2020年1月26日15:52:41
self::hashFilter($hashArray['hash']);
// 发起请求
echo "正在提交转移信息……".PHP_EOL;
$res = self::$curl->post(self::$apiUrl . self::$endpoints['move'], $hashArray);
$res = json_decode($res->response, true);
$resArray = isset($res['data']) && $res['data'] ? $res['data'] : array();
// 写日志
wlog($res, 'move');
// 判断返回值
if (isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok')) {
echo "转移数据返回:成功!!!".PHP_EOL.PHP_EOL;
} else {
$errmsg = isset($res['msg']) && $res['msg'] ? $res['msg'] : '远端服务器无响应,请稍后重试!';
echo '-----转移请求失败,原因:' .$errmsg.PHP_EOL.PHP_EOL;
exit(1);
}
// 可辅种站点信息
$sites = $resArray['sites'];
// 支持站点数量
#self::$wechatMsg['sitesCount'] = count($sites);
// 按客户端移动 开始
foreach (self::$links as $k => $v) {
if (self::$move!=null && self::$move[0] == $k) {
echo "clients_".$k."是目标转移客户端,避免冲突,已跳过!".PHP_EOL.PHP_EOL;
continue;
}
if (empty($resArray['clients_'.$k])) {
echo "clients_".$k."没有查询到可转移数据".PHP_EOL.PHP_EOL;
continue;
}
$infohash_Dir = $move = array();
// info_hash与下载目录对应表
$infohash_Dir = self::$links[$k]['hash'];
// 当前客户端可辅种数据
$move = $resArray['clients_'.$k];
foreach ($move as $info_hash => $value) {
$_url = $url = '';
$download_page = $details_url = '';
// 匹配的辅种数据累加
#self::$wechatMsg['reseedCount']++;
// 当前种子哈希对应的目录
$downloadDir = $infohash_Dir[$info_hash];
// 站点id
$sitesID = $value['sid'];
// 站点名
$siteName = $sites[$sitesID]['site'];
// 页面规则
$download_page = str_replace('{}', $value['torrent_id'], $sites[$sitesID]['download_page']);
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$download_page;
echo "clients_".$k."正在转移... {$siteName}".PHP_EOL;
/**
* 前置检测
*/
// passkey检测
if (empty($configALL[$siteName]['passkey'])) {
echo '-------因当前' .$siteName. "站点未设置passkey已跳过".PHP_EOL.PHP_EOL;
#self::$wechatMsg['reseedSkip']++;
continue;
}
// cookie检测
if (in_array($siteName, self::$cookieCheck) && empty($configALL[$siteName]['cookie'])) {
echo '-------因当前' .$siteName. '站点未设置cookie已跳过' .PHP_EOL.PHP_EOL;
#self::$wechatMsg['reseedSkip']++;
continue;
}
// 流控检测
if (isset($configALL[$siteName]['limit'])) {
echo "-------因当前" .$siteName. "站点触发流控,已跳过!! {$_url}".PHP_EOL.PHP_EOL;
// 流控日志
if ($siteName == 'hdchina') {
$details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1');
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$details_page;
}
wlog('clients_'.$k.PHP_EOL.$downloadDir.PHP_EOL."-------因当前" .$siteName. "站点触发流控,已跳过!! {$_url}".PHP_EOL.PHP_EOL, 'MoveLimit');
#self::$wechatMsg['reseedSkip']++;
continue;
}
// 历史转移检测
if (is_file(self::$cacheMove . $info_hash.'.txt')) {
echo '-------当前种子上次已成功转移,已跳过! '.$_url.PHP_EOL.PHP_EOL;
#self::$wechatMsg['reseedPass']++;
continue;
}
// 不转移的站点检测
if (in_array($siteName, self::$noMove)) {
echo '-------已跳过不转移的站点 ' .$siteName. ' ' .PHP_EOL.PHP_EOL;
#self::$wechatMsg['reseedSkip']++;
continue;
}
/**
* 种子URL组合方式区分
*/
$url = self::getTorrentUrl($siteName, $_url);
/**
* 转移核心
*/
// 特殊站点:推送给下载器种子元数据
switch ($siteName) {
case 'hdchina':
$cookie = isset($configALL[$siteName]['cookie']) ? $configALL[$siteName]['cookie'] : '';
$userAgent = $configALL['default']['userAgent'];
// 拼接URL
$details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1');
$details_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$details_page;
$details_html = download($details_url, $cookie, $userAgent);
print "种子详情页:".$details_url.PHP_EOL;
// 提取种子下载地址
$download_page = str_replace('{}', '', $sites[$sitesID]['download_page']);
$offset = strpos($details_html, $download_page);
$urlTemp = substr($details_html, $offset, 50);
// 种子地址
$_url = substr($urlTemp, 0, strpos($urlTemp, '">'));
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' . $_url;
print "种子下载页:".$_url.PHP_EOL;
$url = download($_url, $cookie, $userAgent);
if (strpos($url, '系统检测到过多的种子下载请求') != false) {
echo "当前站点触发人机验证,已加入排除列表".PHP_EOL;
ff($siteName. '站点,辅种时触发人机验证!');
$configALL[$siteName]['limit'] = 1;
}
break;
case 'hdcity':
$cookie = isset($configALL[$siteName]['cookie']) ? $configALL[$siteName]['cookie'] : '';
$userAgent = $configALL['default']['userAgent'];
print "种子:".$_url.PHP_EOL;
if (isset($configALL[$siteName]['cuhash'])) {
// 已获取cuhash
# code...
} else {
// 获取cuhash
$html = download('https://' .$sites[$sitesID]['base_url']. '/pt', $cookie, $userAgent);
// 提取种子下载地址
$offset = strpos($html, 'cuhash=');
$len = strlen('cuhash=');
$cuhashTemp = substr($html, $offset+$len, 40);
$configALL[$siteName]['cuhash'] = substr($cuhashTemp, 0, strpos($cuhashTemp, '"'));
}
$url = $_url."&cuhash=". $configALL[$siteName]['cuhash'];
// 城市下载种子时会302转向
$url = download($url, $cookie, $userAgent);
break;
default:
// 默认站点推送给下载器种子URL链接
break;
}
echo "种子URL已推送给下载器下载器正在下载种子...".PHP_EOL;
// 实际路径与相对路径之间互转
$downloadDir = self::pathReplace($downloadDir);
if (is_null($downloadDir)) {
die("全局配置的move数组内type配置错误请重新配置".PHP_EOL);
}
$ret = false;
// 把拼接的种子URL推送给下载器
// 成功返回true
$ret = self::add(self::$move[0], $url, $downloadDir);
// 按站点规范日志内容
switch ($siteName) {
case 'hdchina':
$url = $details_url;
break;
case 'hdcity':
$url = $_url;
break;
default:
break;
}
/**
* 转移成功的种子写日志
*/
if ($ret) {
// 转移成功的种子以infohash为文件名写入缓存
wlog($url.PHP_EOL, $info_hash, self::$cacheMove);
wlog($url.PHP_EOL, 'MoveSuccess');
// 成功累加
#self::$wechatMsg['reseedSuccess']++;
continue;
} else {
// 失败的种子
wlog($url.PHP_EOL, 'MoveError');
// 失败累加
#self::$wechatMsg['reseedError']++;
continue;
}
}
}
// 按客户端循环辅种 结束
}
/**
* 过滤已转移的种子hash
*/
public static function hashFilter(&$hash = array())
{
foreach ($hash as $client => $json) {
$data = array();
$data = json_decode($json, true);
if (empty($data)) {
continue;
}
foreach ($data as $key => $info_hash) {
if (is_file(self::$cacheMove . $info_hash.'.txt')) {
echo '-------当前种子上次已成功转移,前置过滤已跳过! ' .PHP_EOL.PHP_EOL;
unset($data[$key]);
}
}
if ($data) {
$data = array_values($data);
}
$hash[$client] = json_encode($data, JSON_UNESCAPED_UNICODE);
}
return $hash;
}
/**
* 实际路径与相对路径之间互相转换
*/
public static function pathReplace($path = '')
{
global $configALL;
$type = $configALL['default']['move']['type'];
$pathArray = $configALL['default']['move']['path'];
switch ($type) {
case 1: // 减
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) {
return substr($path, strlen($key));
}
}
break;
case 2: // 加
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) {
return $val . $path;
}
}
break;
case 3: // 替换
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) {
return $val . substr($path, strlen($key));
}
}
break;
default:
return $path;
break;
}
return null;
}
/**
* 获取站点种子的URL
*/
public static function getTorrentUrl($site = '', $_url = '')
{
global $configALL;
switch ($site) {
case 'ttg':
$url = $_url."/". $configALL[$site]['passkey'];
break;
case 'm-team':
case 'moecat':
$ip_type = '';
if (isset($configALL[$site]['ip_type'])) {
$ip_type = $configALL[$site]['ip_type'] == 'ipv6' ? '&ipv6=1' : '';
}
$url = $_url."&passkey=". $configALL[$site]['passkey'] . $ip_type. "&https=1";
break;
case 'ccfbits':
$url = str_replace('{passkey}', $configALL[$site]['passkey'], $_url);
break;
default:
$url = $_url."&passkey=". $configALL[$site]['passkey'];
break;
}
return $url;
}
/**
* 微信模板消息拼接方法
*/ */
public static function wechatMessage() public static function wechatMessage()
{ {
$br = "\r\n"; $br = PHP_EOL;
$text = 'IYUU自动辅种-统计报表'; $text = 'IYUU自动辅种-统计报表';
$desp = '总做种:'.self::$wechatMsg['hashCount'] . ' [客户端正在做种的hash总数]' .$br; $desp = '总做种:'.self::$wechatMsg['hashCount'] . ' [客户端正在做种的hash总数]' .$br;
$desp .= '返回数据:'.self::$wechatMsg['reseedCount']. ' [服务器返回的可辅种数据]' .$br; $desp .= '返回数据:'.self::$wechatMsg['reseedCount']. ' [服务器返回的可辅种数据]' .$br;

View File

@@ -107,11 +107,16 @@ class TransmissionRPC implements AbstractClientInterface
* Default values for stream context * Default values for stream context
* @var array * @var array
*/ */
private $default_context_opts = array('http' => array( private $default_context_opts = array(
'user_agent' => self::HTTP_UA, 'http' => array(
'timeout' => '60', // Don't want to be too slow 'user_agent' => self::HTTP_UA,
'ignore_errors' => true, // Leave the error parsing/handling to the code 'timeout' => '60', // Don't want to be too slow
) 'ignore_errors' => true, // Leave the error parsing/handling to the code
),
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
)
); );
/** /**
@@ -364,7 +369,9 @@ class TransmissionRPC implements AbstractClientInterface
*/ */
public function add_metainfo($torrent_metainfo, $save_path = '', $extra_options = array()) public function add_metainfo($torrent_metainfo, $save_path = '', $extra_options = array())
{ {
$extra_options['download-dir'] = $save_path; if (!empty($save_path)) {
$extra_options['download-dir'] = $save_path;
}
$extra_options['metainfo'] = base64_encode($torrent_metainfo); $extra_options['metainfo'] = base64_encode($torrent_metainfo);
return $this->request("torrent-add", $extra_options); return $this->request("torrent-add", $extra_options);
@@ -714,10 +721,6 @@ class TransmissionRPC implements AbstractClientInterface
// Setup authentication (if provided) // Setup authentication (if provided)
if ($this->username && $this->password) { if ($this->username && $this->password) {
$contextopts['http']['header'] = sprintf("Authorization: Basic %s\r\n", base64_encode($this->username . ':' . $this->password)); $contextopts['http']['header'] = sprintf("Authorization: Basic %s\r\n", base64_encode($this->username . ':' . $this->password));
$contextopts['http']['ssl'] = array(
"verify_peer"=>false,
"verify_peer_name"=>false,
);
} }
if ($this->debug) { if ($this->debug) {

View File

@@ -124,8 +124,7 @@ class Table
$this->rows = $rows; $this->rows = $rows;
$this->cellAlign = $align; $this->cellAlign = $align;
foreach ($rows as $row) foreach ($rows as $row) {
{
$this->checkColWidth($row); $this->checkColWidth($row);
} }
} }
@@ -138,12 +137,9 @@ class Table
*/ */
protected function checkColWidth($row) protected function checkColWidth($row)
{ {
if (is_array($row)) if (is_array($row)) {
{ foreach ($row as $key => $cell) {
foreach ($row as $key => $cell) if (!isset($this->colWidth[$key]) || strlen($cell) > $this->colWidth[$key]) {
{
if (!isset($this->colWidth[$key]) || strlen($cell) > $this->colWidth[$key])
{
$this->colWidth[$key] = strlen($cell); $this->colWidth[$key] = strlen($cell);
} }
} }
@@ -159,12 +155,9 @@ class Table
*/ */
public function addRow($row, $first = false) public function addRow($row, $first = false)
{ {
if ($first) if ($first) {
{
array_unshift($this->rows, $row); array_unshift($this->rows, $row);
} } else {
else
{
$this->rows[] = $row; $this->rows[] = $row;
} }
@@ -193,8 +186,7 @@ class Table
$style = $this->getStyle($pos); $style = $this->getStyle($pos);
$array = []; $array = [];
foreach ($this->colWidth as $width) foreach ($this->colWidth as $width) {
{
$array[] = str_repeat($style[1], $width + 2); $array[] = str_repeat($style[1], $width + 2);
} }
@@ -211,17 +203,14 @@ class Table
$style = $this->getStyle('cell'); $style = $this->getStyle('cell');
$content = $this->renderSeparator('top'); $content = $this->renderSeparator('top');
foreach ($this->header as $key => $header) foreach ($this->header as $key => $header) {
{
$array[] = ' ' . str_pad($header, $this->colWidth[$key], $style[1], $this->headerAlign); $array[] = ' ' . str_pad($header, $this->colWidth[$key], $style[1], $this->headerAlign);
} }
if (!empty($array)) if (!empty($array)) {
{
$content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL; $content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL;
if ($this->rows) if ($this->rows) {
{
$content .= $this->renderSeparator('middle'); $content .= $this->renderSeparator('middle');
} }
} }
@@ -231,12 +220,9 @@ class Table
protected function getStyle($style) protected function getStyle($style)
{ {
if ($this->format[$this->style]) if ($this->format[$this->style]) {
{
$style = $this->format[$this->style][$style]; $style = $this->format[$this->style][$style];
} } else {
else
{
$style = [' ', ' ', ' ', ' ']; $style = [' ', ' ', ' ', ' '];
} }
@@ -251,8 +237,7 @@ class Table
*/ */
public function render($dataList = []) public function render($dataList = [])
{ {
if ($dataList) if ($dataList) {
{
$this->setRows($dataList); $this->setRows($dataList);
} }
@@ -260,35 +245,26 @@ class Table
$content = $this->renderHeader(); $content = $this->renderHeader();
$style = $this->getStyle('cell'); $style = $this->getStyle('cell');
if ($this->rows) if ($this->rows) {
{ foreach ($this->rows as $row) {
foreach ($this->rows as $row) if (is_string($row) && '-' === $row) {
{
if (is_string($row) && '-' === $row)
{
$content .= $this->renderSeparator('middle'); $content .= $this->renderSeparator('middle');
} } elseif (is_scalar($row)) {
elseif (is_scalar($row))
{
$content .= $this->renderSeparator('cross-top'); $content .= $this->renderSeparator('cross-top');
$array = str_pad($row, 3 * (count($this->colWidth) - 1) + array_reduce($this->colWidth, function ($a, $b) { $array = str_pad($row, 3 * (count($this->colWidth) - 1) + array_reduce($this->colWidth, function ($a, $b) {
return $a + $b; return $a + $b;
})); }));
$content .= $style[0] . ' ' . $array . ' ' . $style[3] . PHP_EOL; $content .= $style[0] . ' ' . $array . ' ' . $style[3] . PHP_EOL;
$content .= $this->renderSeparator('cross-bottom'); $content .= $this->renderSeparator('cross-bottom');
} } else {
else
{
$array = []; $array = [];
foreach ($row as $key => $val) foreach ($row as $key => $val) {
{
$array[] = ' ' . str_pad($val, $this->colWidth[$key], ' ', $this->cellAlign); $array[] = ' ' . str_pad($val, $this->colWidth[$key], ' ', $this->cellAlign);
} }
$content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL; $content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL;
} }
} }
} }
@@ -297,4 +273,4 @@ class Table
return $content; return $content;
} }
} }

View File

@@ -140,7 +140,7 @@ function send($site = '', $torrent = array())
* @param string $method * @param string $method
* @return mixed 返回的数据 * @return mixed 返回的数据
*/ */
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",
@@ -198,16 +198,17 @@ function convertToMB($from)
/** /**
* 字节数Byte转换为KB、MB、GB、TB * 字节数Byte转换为KB、MB、GB、TB
* *
*/ */
function getFilesize($num){ function getFilesize($num)
{
$p = 0; $p = 0;
$format='bytes'; $format='bytes';
if($num>0 && $num<1024){ if ($num>0 && $num<1024) {
$p = 0; $p = 0;
return number_format($num).' '.$format; return number_format($num).' '.$format;
} }
if($num>=1024 && $num<pow(1024, 2)){ if ($num>=1024 && $num<pow(1024, 2)) {
$p = 1; $p = 1;
$format = 'KB'; $format = 'KB';
} }
@@ -323,7 +324,8 @@ function filter($site = '', $torrent = array())
/** /**
* 日志记录函数 * 日志记录函数
*/ */
function wlog($data='',$name = '',$path = ''){ function wlog($data='', $name = '', $path = '')
{
// 数据转换 // 数据转换
if (is_bool($data)) { if (is_bool($data)) {
$show_data=$data ? 'true' : 'false'; $show_data=$data ? 'true' : 'false';
@@ -336,8 +338,8 @@ function wlog($data='',$name = '',$path = ''){
$dir = $path===''? TORRENT_PATH . 'cache' . DS : $path; $dir = $path===''? TORRENT_PATH . 'cache' . DS : $path;
IFile::mkdir($dir); IFile::mkdir($dir);
$myfile = $dir.$name.'.txt'; $myfile = $dir.$name.'.txt';
$file_pointer = @fopen($myfile,"a"); $file_pointer = @fopen($myfile, "a");
$worldsnum = @fwrite($file_pointer,$show_data); $worldsnum = @fwrite($file_pointer, $show_data);
@fclose($file_pointer); @fclose($file_pointer);
return $worldsnum; return $worldsnum;
} }
@@ -389,22 +391,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);
} }
/** /**
@@ -412,15 +415,17 @@ 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;
} }
/** /**
* 显示支持的站点列表 * 显示支持的站点列表
*/ */
function ShowTableSites($dir = 'Protocols',$filter = array()){ function ShowTableSites($dir = 'Protocols', $filter = array())
{
// 过滤的文件 // 过滤的文件
switch ($dir) { switch ($dir) {
case 'Protocols': case 'Protocols':
@@ -434,31 +439,30 @@ function ShowTableSites($dir = 'Protocols',$filter = array()){
break; break;
} }
$data = []; $data = [];
$i = $j = $k = 0; $i = $j = $k = 0;
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,'/'); if ($offset===false) {
if ($offset===false) { $start_file = substr($start_file, 0, -4);
$start_file = substr($start_file,0,-4); } else {
} else { $start_file = substr($start_file, $offset+1, -4);
$start_file = substr($start_file,$offset+1,-4);
} }
// 过滤示例、过滤解码接口 // 过滤示例、过滤解码接口
if (in_array($start_file, $filter)) { if (in_array($start_file, $filter)) {
continue; continue;
} }
// 控制多少列 // 控制多少列
if ($i > 4) { if ($i > 4) {
$k++; $k++;
$i = 0; $i = 0;
} }
$i++; $i++;
$j++; $j++;
$data[$k][] = $j.". ".$start_file; $data[$k][] = $j.". ".$start_file;
} }
//输出表格 //输出表格
$table = new Table(); $table = new Table();
$table->setRows($data); $table->setRows($data);
echo($table->render()); echo($table->render());
} }

View File

@@ -3,7 +3,6 @@
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-curl": "*", "ext-curl": "*",
"owner888/phpspider": "^2.1",
"curl/curl": "^2.2" "curl/curl": "^2.2"
}, },
"autoload": { "autoload": {

60
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "32806a4860870f6306b69cf349584387", "content-hash": "10281f19c929443b7db18d1ab159ec63",
"packages": [ "packages": [
{ {
"name": "curl/curl", "name": "curl/curl",
@@ -66,58 +66,6 @@
"dot" "dot"
], ],
"time": "2018-12-04T19:47:03+00:00" "time": "2018-12-04T19:47:03+00:00"
},
{
"name": "owner888/phpspider",
"version": "v2.1.6",
"source": {
"type": "git",
"url": "https://github.com/owner888/phpspider.git",
"reference": "e6021148adec201418c16ba26f39bc013ba5b4d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/owner888/phpspider/zipball/e6021148adec201418c16ba26f39bc013ba5b4d9",
"reference": "e6021148adec201418c16ba26f39bc013ba5b4d9",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.5.0"
},
"suggest": {
"ext-pcntl、ext-redis": "For better performance. "
},
"type": "library",
"autoload": {
"psr-4": {
"phpspider\\": "./"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Seatle Yang",
"email": "seatle@foxmail.com",
"homepage": "http://www.phpspider.org",
"role": "Developer"
}
],
"description": "The PHPSpider Framework.",
"homepage": "http://www.phpspider.org",
"keywords": [
"framework",
"phpspider"
],
"time": "2018-08-15T08:04:29+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
@@ -126,6 +74,10 @@
"stability-flags": [], "stability-flags": [],
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": {
"ext-json": "*",
"ext-mbstring": "*",
"ext-curl": "*"
},
"platform-dev": [] "platform-dev": []
} }

View File

@@ -3,7 +3,15 @@
* 技术讨论及后续更新请加入QQ群 * 技术讨论及后续更新请加入QQ群
群名称IYUU自动辅种交流 群名称IYUU自动辅种交流
QQ群号859882209 QQ群号859882209
* 手动配置方法,请查看:https://www.iyuu.cn/archives/324/ * IYUU自动辅种工具--最简配置(所有平台通用教程) https://www.iyuu.cn/archives/324/
* IYUU自动辅种工具--如何下载最新源码? https://www.iyuu.cn/archives/338/
* IYUU自动辅种工具--合作站点鉴权配置说明 https://www.iyuu.cn/archives/337/
* IYUU自动下载种子之RSS订阅使用教程 https://www.iyuu.cn/archives/349/
* IYUU自动转移做种客户端-使用教程 https://www.iyuu.cn/archives/351/
脚本仓库下载法:
git clone https://github.com/ledccn/IYUUAutoReseed
cd IYUUAutoReseed
composer install
*/ */
return array( return array(
// 1.【必须配置】爱语飞飞 微信通知请访问https://iyuu.cn 用微信扫码申请 // 1.【必须配置】爱语飞飞 微信通知请访问https://iyuu.cn 用微信扫码申请
@@ -25,12 +33,13 @@ return array(
'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告注意transmission/rpc这段别动你只需要修改 127.0.0.1:9091 'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告注意transmission/rpc这段别动你只需要修改 127.0.0.1:9091
'username' => '', 'username' => '',
'password' => '', 'password' => '',
#'move' => 0, // 0不移动1移动并辅种2移动仅辅种自身3未定义4未定义
), ),
# 结束 # 结束
# 开始 # 开始
array( array(
'type' => 'qBittorrent', // 支持transmission、qBittorrent 'type' => 'qBittorrent', // 支持transmission、qBittorrent
'host' => 'http://www.baidu.com:8083', 'host' => 'http://127.0.0.1:8083',
'username' => '', 'username' => '',
'password' => '', 'password' => '',
), ),
@@ -38,9 +47,30 @@ return array(
// 全局客户端设置 结束 // 全局客户端设置 结束
), ),
'move' =>array( 'move' =>array(
'type' => 2, // 0保持不变1减2加 3直接替换 'type' => 0, // 0保持不变1减2加3替换
'path' =>array( 'path' =>array(
'/sda1' => '/volume1', // 当前路径 => 目标路径
'/downloads' => '/volume1',
),
),
'workingMode' => 0,
'watch' => '/volume1/downloads',
'filter' => array(
'size'=>array(
'min' => '1GB',
'max' => '280GB',
),
'seeders'=>array(
'min' => 1,
'max' => 3,
),
'leechers'=>array(
'min' => 0,
'max' => 10000,
),
'completed'=>array(
'min' => 0,
'max' => 10000,
), ),
), ),
'CONNECTTIMEOUT'=> 60, 'CONNECTTIMEOUT'=> 60,
@@ -58,6 +88,23 @@ return array(
'passkey' => '', 'passkey' => '',
// 种子Tracker的IP地址选择 可选ipv4ipv6 // 种子Tracker的IP地址选择 可选ipv4ipv6
'ip_type' => 'ipv4', 'ip_type' => 'ipv4',
'clients' => array(
array(
'type' => 'transmission', // 支持transmission、qBittorrent
'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告注意transmission/rpc这段别动你只需要修改 127.0.0.1:9091
'username' => '',
'password' => '',
'downloadDir'=> '',
),
),
'workingMode' => 1,
'watch' => '',
'filter' => array(
'size'=>array(
'min' => '1GB',
'max' => '280GB',
),
),
), ),
// keepfrds 序号2 // keepfrds 序号2
'keepfrds' => array( 'keepfrds' => array(
@@ -65,6 +112,14 @@ return array(
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
'workingMode' => 1,
'watch' => '',
'filter' => array(
'size'=>array(
'min' => '1GB',
'max' => '280GB',
),
),
), ),
// ourbits 序号3 // ourbits 序号3
'ourbits' => array( 'ourbits' => array(
@@ -74,6 +129,14 @@ return array(
'passkey' => '', 'passkey' => '',
'id' => 0, // 用户ID 'id' => 0, // 用户ID
'is_vip' => 0, // 是否具有VIP或特殊权限0 普通1 VIP 'is_vip' => 0, // 是否具有VIP或特殊权限0 普通1 VIP
'workingMode' => 0,
'watch' => '/root/downloads',
'filter' => array(
'size'=>array(
'min' => '1GB',
'max' => '280GB',
),
),
), ),
// HDSky 序号4 // HDSky 序号4
'hdsky' => array( 'hdsky' => array(
@@ -153,6 +216,8 @@ return array(
'cookie' => '', 'cookie' => '',
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
// 如果需要rss订阅必须配置
'rss' => '',
), ),
// nanyangpt 序号15 // nanyangpt 序号15
'nanyangpt' => array( 'nanyangpt' => array(
@@ -308,7 +373,7 @@ return array(
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// upxin 序号37 // hdu 序号37
'upxin' => array( 'upxin' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项) // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '', 'cookie' => '',
@@ -357,6 +422,20 @@ return array(
// 如果需要自动辅种,必须配置 // 如果需要自动辅种,必须配置
'passkey' => '', 'passkey' => '',
), ),
// byr 序号44 北邮
'byr' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '',
// 如果需要自动辅种,必须配置
'passkey' => '',
),
// CCFBits 序号45
'ccfbits' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '',
// 如果需要自动辅种,必须配置
'passkey' => '',
),
// 配置文件结束 // 配置文件结束
); );

View File

@@ -1,7 +1,4 @@
<?php <?php
//----------------------------------
// 公共入口文件
//----------------------------------
// 定义目录 // 定义目录
defined('ROOT_PATH') or define("ROOT_PATH", __DIR__); defined('ROOT_PATH') or define("ROOT_PATH", __DIR__);
define('DS', DIRECTORY_SEPARATOR); define('DS', DIRECTORY_SEPARATOR);
@@ -10,7 +7,7 @@ define('TORRENT_PATH', ROOT_PATH.DS.'torrent'.DS);
// 严格开发模式 // 严格开发模式
error_reporting(E_ALL); error_reporting(E_ALL);
#ini_set('display_errors', 1); ini_set('display_errors', 1);
// 永不超时 // 永不超时
ini_set('max_execution_time', 0); ini_set('max_execution_time', 0);
@@ -27,7 +24,7 @@ if (PHP_SAPI != 'cli') {
// 设置时区 // 设置时区
date_default_timezone_set('Asia/Shanghai'); date_default_timezone_set('Asia/Shanghai');
echo microtime(true).' 环境变量初始化完成!'.PHP_EOL;
// 系统配置 // 系统配置
if (file_exists(ROOT_PATH."/config/config.php")) { if (file_exists(ROOT_PATH."/config/config.php")) {
// 配置(全局变量) // 配置(全局变量)
@@ -36,16 +33,18 @@ if (file_exists(ROOT_PATH."/config/config.php")) {
// 示例配置 // 示例配置
$configALL = require_once ROOT_PATH . '/config/config.sample.php'; $configALL = require_once ROOT_PATH . '/config/config.sample.php';
} }
echo microtime(true).' 全局配置载入完成!'.PHP_EOL;
// 读取支持列表 // 读取支持列表
if (is_file(ROOT_PATH . "/config/sites.json")) { if (is_file(ROOT_PATH . "/config/sites.json")) {
$sitesJson = file_get_contents(ROOT_PATH . "/config/sites.json"); $sitesJson = file_get_contents(ROOT_PATH . "/config/sites.json");
$configALL['sitesALL'] = json_decode($sitesJson, true); $configALL['sitesALL'] = json_decode($sitesJson, true);
echo microtime(true).' 支持站点JSON载入完成'.PHP_EOL;
} }
require_once ROOT_PATH . '/vendor/autoload.php'; require_once ROOT_PATH . '/vendor/autoload.php';
echo microtime(true).' composer依赖载入完成'.PHP_EOL;
global $argv; global $argv;
$start_file = str_replace("\\","/",trim($argv[0])); $start_file = str_replace("\\", "/", trim($argv[0]));
if( substr($start_file,-8)==="init.php" ){ if (substr($start_file, -8)==="init.php") {
require_once __DIR__ . '/iyuu.php'; require_once __DIR__ . '/iyuu.php';
} }

View File

@@ -2,11 +2,8 @@
require_once __DIR__ . '/init.php'; require_once __DIR__ . '/init.php';
use IYUU\AutoReseed; use IYUU\AutoReseed;
echo microtime(true).' IYUU自动辅种正在初始化...'.PHP_EOL;
AutoReseed::init(); AutoReseed::init();
$hashArray = AutoReseed::get(); $hashArray = AutoReseed::get();
if (AutoReseed::$move != null) {
echo "种子移动完毕,请重新编辑配置,再尝试辅种! \n\n";
exit;
}
AutoReseed::call($hashArray); AutoReseed::call($hashArray);
AutoReseed::wechatMessage(); exit(0);

View File

@@ -29,10 +29,10 @@ IYUU自动辅种工具英文名IYUUAutoReseed是一款PHP语言编
2. qBittorrent 2. qBittorrent
## 支持自动辅种的站点 ## 支持自动辅种的站点
学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、TCCF、南洋、TTG、映客、城市、52pt、brobits、备胎、SSD、CHD、ptmsg、leaguehd、聆音、瓷器、hdarea、eastgame(TLF)、1ptba、hdtime、hd4fans、opencd、hdbug、hdstreet、joyhd、u2、upxin(HDU)、oshen、discfan(GZT)、cnscg圣城(已删除)。 学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、TCCF、南洋、TTG、映客、城市、52pt、brobits、备胎、SSD、CHD、ptmsg、leaguehd、聆音、瓷器、hdarea、eastgame(TLF)、1ptba、hdtime、hd4fans、opencd、hdbug、hdstreet、joyhd、u2、upxin(HDU)、oshen、discfan(GZT)、cnscg圣城(已删除)、北邮、CCFBits
## 运行环境 ## 运行环境
所有具备PHP运行环境的所有平台例如Linux、Windows、MacOS 具备PHP运行环境的所有平台例如Linux、Windows、MacOS
官方下载的记得开启crul、fileinfo、mbstring这3个扩展。 官方下载的记得开启crul、fileinfo、mbstring这3个扩展。
@@ -43,8 +43,15 @@ IYUU自动辅种工具英文名IYUUAutoReseed是一款PHP语言编
- github仓库https://github.com/ledccn/IYUUAutoReseed - github仓库https://github.com/ledccn/IYUUAutoReseed
- 码云仓库https://gitee.com/ledc/IYUUAutoReseed - 码云仓库https://gitee.com/ledc/IYUUAutoReseed
## 使用方法 ## 使用方法
详见Wiki https://gitee.com/ledc/IYUUAutoReseed/wikis 详见Wiki
https://gitee.com/ledc/IYUUAutoReseed/wikis
https://gitee.com/ledc/IYUUAutoReseed/tree/master/wiki
## 接口文档
http://api.iyuu.cn/docs.php?type=expand
## 需求提交/错误反馈 ## 需求提交/错误反馈
- 点击链接加入群聊【IYUU自动辅种交流】[https://jq.qq.com/?_wv=1027&k=5JOfOlM][1] - 点击链接加入群聊【IYUU自动辅种交流】[https://jq.qq.com/?_wv=1027&k=5JOfOlM][1]
@@ -59,8 +66,6 @@ IYUU自动辅种工具英文名IYUUAutoReseed是一款PHP语言编
**您所有的打赏将用于服务器续期,增加服务的延续性。** **您所有的打赏将用于服务器续期,增加服务的延续性。**
![微信打赏.png][2]
## 捐赠者列表 ## 捐赠者列表
感谢以下捐赠者,排名不分先后! 感谢以下捐赠者,排名不分先后!
@@ -104,6 +109,10 @@ IYUU自动辅种工具英文名IYUUAutoReseed是一款PHP语言编
| 寒山先生 | ¥100元 | 2020年1月11日11:47 | | 寒山先生 | ¥100元 | 2020年1月11日11:47 |
| 天空(感谢远程指导小意思) | ¥20元 | 2020年1月14日23:11 | | 天空(感谢远程指导小意思) | ¥20元 | 2020年1月14日23:11 |
| 寒山先生 | ¥200元 | 2020年1月18日12:37 | | 寒山先生 | ¥200元 | 2020年1月18日12:37 |
| 小城流水 | ¥5元 | 2020年1月22日22:14 |
| 国旗(未署名) | ¥8.8元 | 2020年1月22日23:28 |
| 当下丶 | ¥100元 | 2020年1月28日1:45 |
补充说明: 补充说明:

View File

@@ -0,0 +1,170 @@
IYUU新推出RSS订阅功能
## 功能
自动订阅站点的新种,自动添加下载任务,支持大小过滤。
## 优势
1.弥补部分下载器没有RSS订阅的缺陷
2.与下载器本身的RSS功能相比IYUU自动RSS订阅支持远程连接下载器支持下载器多盘位、支持多目录支持筛选支持下载器集群
## 需要配置什么?
1.必须配置各站的`passkey`秘钥,从各站点的`控制面板`复制到配置文件内对应站点`passkey`处即可;
2.TTG的密钥比较特殊请从RSS链接处复制并给站点配置加一个`rss`配置项详情参考示例配置文件TTG配置
前期如果你正确使用了`IYUUAutoReseed自动辅种工具`的话,本部分就非常简单了。
----------
## 如何配置`workingMode`工作模式、`watch`监控目录、`cliects`下载器?
### 第一步完善全局配置
```php
'default' => array(
// 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',
// 6.【自动辅种必须配置】全局客户端设置(条目不够可以复制)
'clients' => array(
// 全局客户端设置 开始
# 开始
array(
'type' => 'transmission', // 支持transmission、qBittorrent
'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告注意transmission/rpc这段别动你只需要修改 127.0.0.1:9091
'username' => '',
'password' => '',
),
# 结束
# 开始
array(
'type' => 'qBittorrent', // 支持transmission、qBittorrent
'host' => 'http://www.baidu.com:8083',
'username' => '',
'password' => '',
),
# 结束
// 全局客户端设置 结束
),
'move' =>array(
'type' => 2, // 0保持不变1减2加 3直接替换
'path' =>array(
'/sda1' => '/volume1',
),
),
'workingMode' => 0,
'watch' => '/volume1/downloads',
'filter' => array(
'size'=>array(
'min' => '10GB',
'max' => '280GB',
),
'seeders'=>array(
'min' => 1,
'max' => 3,
),
'leechers'=>array(
'min' => 0,
'max' => 10000,
),
'completed'=>array(
'min' => 0,
'max' => 10000,
),
),
'CONNECTTIMEOUT'=> 60,
'TIMEOUT' => 600,
),
```
----------
### 第二步完善站点配置示例配置m-team
本部分以馒头为例,讲解`工作模式1负载均衡`
关键地方:`clients``workingMode``watch``filter`
- 全局已经配置clients两个用来辅种站点单独配置clients一个用来下载在RSS订阅添加下载任务时**以站点单独配置的clients为准**。
- `workingMode=>1,` 代表当前站点将会工作在模式1
- `watch=>''` 因为站点工作在模式1配置了也无效**留空即可**
- 全局和站点都配置filter该站点RSS订阅添加下载任务时**过滤规则以站点配置为准**
下面是m-team的示例配置代码。
```php
'm-team' => array(
// 14.m-team的cookie 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => 'tp=',
// 15.m-team的passkey 【必须配置】
'passkey' => '',
// 种子Tracker的IP地址选择 可选ipv4ipv6
'ip_type' => 'ipv4',
'clients' => array(
array(
'type' => 'transmission', // 支持transmission、qBittorrent
'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告注意transmission/rpc这段别动你只需要修改 127.0.0.1:9091
'username' => '',
'password' => '',
),
),
'workingMode' => 1,
'watch' => '',
'filter' => array(
'size'=>array(
'min' => '1GB',
'max' => '280GB',
),
),
),
```
----------
### 第三步完善站点配置示例配置keepfrds
本部分以朋友为例讲解工作模式1负载均衡
关键地方:`clients``workingMode``watch``filter`
- 全局已经配置clients两个用来辅种**站点没有单独配置clients在RSS订阅添加下载任务时以全局配置的clients为准**。
- `workingMode=>1,` 代表当前站点将会工作在模式1
- `watch=>''` 因为站点工作在模式1配置了也无效**留空即可**
- 全局和站点都配置filter该站点RSS订阅添加下载任务时**过滤规则以站点配置为准**
下面是keepfrds的示例配置代码。
```php
'keepfrds' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '',
// 如果需要自动辅种,必须配置
'passkey' => '',
'workingMode' => 1,
'watch' => '',
'filter' => array(
'size'=>array(
'min' => '1GB',
'max' => '280GB',
),
),
),
```
----------
### 第四步完善站点配置示例配置ourbits
本部分以我堡为例讲解工作模式0watch监控目录
关键地方:`workingMode``watch``filter`
- `workingMode=>0,` 代表当前站点将会工作在模式0**脚本会往指定的watch目录内下载种子**,由下载器添加下载任务;
- `watch=>'/root/downloads'` 脚本会往`/root/downloads`目录内下载种子,由下载器添加下载任务;
- 全局和站点都配置filter该站点RSS订阅添加下载任务时**过滤规则以站点配置为准**
下面是ourbits的示例配置代码。
```php
'ourbits' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '',
// 如果需要自动辅种,必须配置
'passkey' => '',
'id' => 0, // 用户ID
'is_vip' => 0, // 是否具有VIP或特殊权限0 普通1 VIP
'workingMode' => 0,
'watch' => '/root/downloads',
'filter' => array(
'size'=>array(
'min' => '1GB',
'max' => '280GB',
),
),
),
```
**总结以上概况讲解了RSS订阅下载、下载免费种时的各种配置的情况请仔细阅读务必理解**

View File

@@ -12,7 +12,6 @@ IYUU自动辅种工具、Ourbits双方达成合作可以对使用接口的用
### 设置Ourbits ### 设置Ourbits
![编辑配置4.png][5] ![编辑配置4.png][5]
`passkey`,在你的控制面板 - 密钥 `passkey`,在你的控制面板 - 密钥
`is_vip`,根据你的实际情况填写,因站点有下载种子的流控,如果你不在限制之列,可以`设置为1`
`id`,为用户中心打开后,浏览器地址栏**http://xxxxx.xxx/userdetails.php?id=`46880`**等号=后面的几个数字,如图: `id`,为用户中心打开后,浏览器地址栏**http://xxxxx.xxx/userdetails.php?id=`46880`**等号=后面的几个数字,如图:
![编辑配置6.png][6] ![编辑配置6.png][6]

View File

@@ -28,24 +28,6 @@
按站内说明修改下载器所在设备的HOST或者在具备修改HOST功能的路由器内修改。 按站内说明修改下载器所在设备的HOST或者在具备修改HOST功能的路由器内修改。
#### 问:我拥有辅种时自动跳过站点的特殊权限,如何设置为可以辅种呢?
答:在站点的独立配置区域,添加一行代码`'is_vip' => 1,`即可。例如Ourbits
```php
// ourbits
'ourbits' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '',
// 如果需要自动辅种,必须配置
'passkey' => '',
'id' => 46880, // 用户ID
'is_vip' => 1, // 是否具有VIP或特殊权限0 普通1 VIP
),
```
#### 问:如何升级到最新版本? #### 问:如何升级到最新版本?
从github或码云仓库下载最新的源码覆盖到本地即可。 从github或码云仓库下载最新的源码覆盖到本地即可。
@@ -87,7 +69,7 @@
2.手动下载种子,看看是否出现了下载种子的提示页? 2.手动下载种子,看看是否出现了下载种子的提示页?
3.瓷器、城市需要cookie辅种请检查cookie是否配置正确如果下载出现提示页面需要更新配置内的cookie、更新cookid 3.瓷器、城市需要cookie辅种请检查cookie是否配置正确如果下载出现提示页面需要更新配置内的cookie、更新cookie
如果整个站都失败,请按以上步骤排查。 如果整个站都失败,请按以上步骤排查。

View File

@@ -8,8 +8,8 @@
| 自动辅种结束微信通知 | 已完成 | 2019年12月25日 | 2019年12月27日 | | 自动辅种结束微信通知 | 已完成 | 2019年12月25日 | 2019年12月27日 |
| 做种客户端间转移 | 已完成 | 2019年12月25日 | 2020年1月14日 | | 做种客户端间转移 | 已完成 | 2019年12月25日 | 2020年1月14日 |
| 手动辅种按目录分组 | 已完成 | 2019年12月26日 | 2020年1月14日 | | 手动辅种按目录分组 | 已完成 | 2019年12月26日 | 2020年1月14日 |
| 自动转移客户端 | 已完成 | 2020年1月27日 | 2020年1月29日 |
| WEB页面生成配置 | 暂未开始 | | | | WEB页面生成配置 | 暂未开始 | | |
| 自动转移客户端 | 暂未开始 | | |
| 脚本docker容器化 | 暂未开始 | | | | 脚本docker容器化 | 暂未开始 | | |
| 浏览器插件 | 暂未开始 | | | | 浏览器插件 | 暂未开始 | | |
| 合集自动拆包辅种 | 暂未开始 | | | | 合集自动拆包辅种 | 暂未开始 | | |

View File

@@ -1,3 +1,15 @@
### 2020年1月30日
新增CCFBits站点辅种
### 2020年1月28日
新增:北邮站点辅种
新增:做种客户端转移功能
优化:删除用不到的依赖包
### 2020年1月21日 ### 2020年1月21日
新增支持的站点列表json本地化 新增支持的站点列表json本地化

View File

@@ -79,7 +79,7 @@ IYUU自动辅种工具、Ourbits双方达成合作可以对使用接口的用
## Windows安装PHP运行环境 ## Windows安装PHP运行环境
也可以去官方下载【https://www.php.net/downloads】官方下载的记得开启`curl、fileinfo、mbstring`这3个扩展。 也可以去官方下载【https://www.php.net/downloads】官方下载的记得开启`curl、fileinfo、mbstring`这3个扩展。
另外我打包了一份,下载地址: 另外我打包了一份,下载地址:
微云链接https://share.weiyun.com/5EiXLfn 密码ezsvnb 微云链接https://share.weiyun.com/5I13dek 密码utcjsx
下载回来是一个ZIP压缩包解压到`D:\IYUUAutoReseed\`目录内,文件结构如图: 下载回来是一个ZIP压缩包解压到`D:\IYUUAutoReseed\`目录内,文件结构如图:
![编辑配置7.png][12] ![编辑配置7.png][12]
点击红框内`执行辅种`即可。 点击红框内`执行辅种`即可。

4
执行辅种.cmd Normal file
View File

@@ -0,0 +1,4 @@
@echo off
chcp 65001
%cd%\php-7.2.12-nts\php %cd%\iyuu.php
pause

4
计划任务.cmd Normal file
View File

@@ -0,0 +1,4 @@
@echo off
chcp 65001
D:\IYUUAutoReseed\php-7.2.12-nts\php D:\IYUUAutoReseed\iyuu.php
exit