mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-08-26 16:04:49 +00:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fcb2384949 | ||
|
33b55d7598 | ||
|
db8290fe89 | ||
|
81083220c5 | ||
|
39cb00d648 | ||
|
db9010cee7 | ||
|
ad6f798946 | ||
|
36d07a25db | ||
|
7c35291b15 | ||
|
7d531a26c8 | ||
|
385a122f02 | ||
|
f75feeca44 | ||
|
d8fc340691 | ||
|
2345124ce0 | ||
|
f9592c6b0d | ||
|
fd695e4209 | ||
|
8ddb143485 | ||
|
ef2668ca54 | ||
|
51f3fa39bc | ||
|
84b3f23c27 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@
|
||||
/vendor
|
||||
.idea
|
||||
.php_cs.cache
|
||||
/config/sites.json
|
||||
|
@@ -10,6 +10,7 @@ use IYUU\Client\qBittorrent\qBittorrent;
|
||||
use IYUU\Client\Transmission\TransmissionRPC;
|
||||
use IYUU\Library\IFile;
|
||||
use IYUU\Library\Oauth;
|
||||
use IYUU\Library\Table;
|
||||
|
||||
/**
|
||||
* IYUUAutoReseed自动辅种类
|
||||
@@ -89,6 +90,8 @@ class AutoReseed
|
||||
*/
|
||||
public static function init()
|
||||
{
|
||||
// 显示支持站点列表
|
||||
self::ShowTableSites();
|
||||
global $configALL;
|
||||
self::$clients = isset($configALL['default']['clients']) && $configALL['default']['clients'] ? $configALL['default']['clients'] : array();
|
||||
echo "程序正在初始化运行参数... \n";
|
||||
@@ -103,6 +106,53 @@ class AutoReseed
|
||||
Oauth::login(self::$apiUrl . self::$endpoints['login']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示支持站点列表
|
||||
*/
|
||||
private static function ShowTableSites(){
|
||||
$list[] = 'gitee 源码仓库:https://gitee.com/ledc/IYUUAutoReseed';
|
||||
$list[] = 'github源码仓库:https://github.com/ledccn/IYUUAutoReseed';
|
||||
$list[] = '教程:https://gitee.com/ledc/IYUUAutoReseed/tree/master/wiki';
|
||||
$list[] = "QQ群:859882209 【IYUU自动辅种交流】 \n";
|
||||
foreach ($list as $key => $value) {
|
||||
echo $value.PHP_EOL;
|
||||
}
|
||||
// 发起请求
|
||||
echo "正在连接IYUUAutoReseed服务器,查询支持列表…… \n";
|
||||
$curl = new Curl();
|
||||
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false); // 禁止验证证书
|
||||
$curl->setOpt(CURLOPT_SSL_VERIFYHOST, false); // 不检查证书
|
||||
$res = $curl->post(self::$apiUrl);
|
||||
$sites = json_decode($res->response, true);
|
||||
// 数据写入本地
|
||||
if (true) {
|
||||
$json = array_column($sites, null, 'site');
|
||||
ksort($json);
|
||||
$json = json_encode($json, JSON_UNESCAPED_UNICODE);
|
||||
$myfile = ROOT_PATH.DS.'config'.DS.'sites.json';
|
||||
$file_pointer = @fopen($myfile,"w");
|
||||
$worldsnum = @fwrite($file_pointer,$json);
|
||||
@fclose($file_pointer);
|
||||
}
|
||||
$data = [];
|
||||
$i = $j = $k = 0;
|
||||
foreach($sites as $v)
|
||||
{
|
||||
// 控制多少列
|
||||
if ($i > 4) {
|
||||
$k++;
|
||||
$i = 0;
|
||||
}
|
||||
$i++;
|
||||
$j++;
|
||||
$data[$k][] = $j.". ".$v['site'];
|
||||
}
|
||||
echo "IYUUAutoReseed自动辅种脚本,目前支持以下站点:".PHP_EOL;
|
||||
//输出表格
|
||||
$table = new Table();
|
||||
$table->setRows($data);
|
||||
echo($table->render());
|
||||
}
|
||||
/**
|
||||
* 连接远端RPC服务器
|
||||
*
|
||||
@@ -355,25 +405,15 @@ class AutoReseed
|
||||
$hashArray['sign'] = Oauth::getSign();
|
||||
$hashArray['version'] = self::VER;
|
||||
// 写请求日志
|
||||
if (true) {
|
||||
// 文件句柄
|
||||
$resource = fopen(self::$cacheDir.'hashString.txt', "wb");
|
||||
// 成功:返回写入字节数,失败返回false
|
||||
$worldsnum = fwrite($resource, p($hashArray, false));
|
||||
fclose($resource);
|
||||
}
|
||||
wlog($hashArray,'hashString');
|
||||
|
||||
// 发起请求
|
||||
echo "正在提交辅种信息…… \n";
|
||||
$res = $curl->post(self::$apiUrl . self::$endpoints['reseed'], $hashArray);
|
||||
$resArray = json_decode($res->response, true);
|
||||
// 写返回日志
|
||||
if(true){
|
||||
// 文件句柄
|
||||
$resource = fopen(self::$cacheDir.'reseed.txt', "wb");
|
||||
// 成功:返回写入字节数,失败返回false
|
||||
$worldsnum = fwrite($resource, p($resArray, false));
|
||||
fclose($resource);
|
||||
}
|
||||
wlog($resArray,'reseed');
|
||||
|
||||
// 判断返回值
|
||||
if (isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok')) {
|
||||
echo "辅种信息提交成功!!! \n\n";
|
||||
@@ -430,6 +470,12 @@ class AutoReseed
|
||||
// 流控检测
|
||||
if (isset($configALL[$sites[$sitesID]['site']]['limit'])) {
|
||||
echo "-------因当前" .$sites[$sitesID]['site']. "站点触发流控,已跳过!! {$_url} \n\n";
|
||||
// 流控日志
|
||||
if ($sites[$sitesID]['site'] == 'hdchina') {
|
||||
$details_page = str_replace('{}', $value['torrent_id'], 'details.php?id={}&hit=1');
|
||||
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' .$details_page;
|
||||
}
|
||||
wlog('clients_'.$k."\n".$downloadDir."\n"."-------因当前" .$sites[$sitesID]['site']. "站点触发流控,已跳过!! {$_url} \n\n",'reseedLimit');
|
||||
self::$wechatMsg['reseedSkip']++;
|
||||
continue;
|
||||
}
|
||||
@@ -527,9 +573,7 @@ class AutoReseed
|
||||
$ret = false;
|
||||
// 成功返回:true
|
||||
$ret = self::add($k, $url, $downloadDir);
|
||||
// 添加成功的种子,以infohash为文件名,写入缓存
|
||||
if ($ret) {
|
||||
// 成功的种子
|
||||
// 按站点规范日志内容
|
||||
switch ($sites[$sitesID]['site']) {
|
||||
case 'hdchina':
|
||||
$url = $details_url;
|
||||
@@ -540,22 +584,17 @@ class AutoReseed
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 文件句柄
|
||||
$resource = fopen(self::$cacheHash . $value['info_hash'].'.txt', "wb");
|
||||
// 成功:返回写入字节数,失败返回false
|
||||
$worldsnum = fwrite($resource, $url);
|
||||
fclose($resource);
|
||||
// 添加成功的种子,以infohash为文件名,写入缓存
|
||||
if ($ret) {
|
||||
// 成功的种子
|
||||
wlog($url."\n", $value['info_hash'], self::$cacheHash);
|
||||
wlog($url."\n",'reseedSuccess');
|
||||
// 成功累加
|
||||
self::$wechatMsg['reseedSuccess']++;
|
||||
continue;
|
||||
} else {
|
||||
// 失败的种子
|
||||
// 不同站点的错误提示
|
||||
switch ($sites[$sitesID]['site']) {
|
||||
case 'hdcity':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wlog($url."\n",'reseedError');
|
||||
// 失败累加
|
||||
self::$wechatMsg['reseedError']++;
|
||||
continue;
|
||||
@@ -565,22 +604,19 @@ class AutoReseed
|
||||
* 不辅种
|
||||
*/
|
||||
echo '-------已跳过不辅种的站点:'.$_url."\n\n";
|
||||
// 写入日志文件,供用户手动辅种
|
||||
if ( !isset($infohash_Dir[$value['info_hash']]) ) {
|
||||
// 站点类型判断
|
||||
// 按站点规范日志内容
|
||||
switch ($sites[$sitesID]['site']) {
|
||||
case 'hdchina':
|
||||
$url = $details_url;
|
||||
break;
|
||||
case 'hdcity':
|
||||
$url = $_url;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 文件句柄
|
||||
$resource = fopen(self::$cacheDir . $sites[$sitesID]['site'].'.txt', 'a');
|
||||
// 成功:返回写入字节数,失败返回false
|
||||
$worldsnum = fwrite($resource, 'clients_'.$k."\n".$downloadDir."\n".$url."\n".$details_url."\n\n");
|
||||
fclose($resource);
|
||||
}
|
||||
// 写入日志文件,供用户手动辅种
|
||||
wlog('clients_'.$k."\n".$downloadDir."\n".$url."\n".$details_url."\n\n", $sites[$sitesID]['site']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,5 +17,4 @@ interface AbstractClientInterface
|
||||
* @return string
|
||||
*/
|
||||
public function status();
|
||||
|
||||
}
|
||||
|
@@ -714,6 +714,10 @@ class TransmissionRPC implements AbstractClientInterface
|
||||
// Setup authentication (if provided)
|
||||
if ($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) {
|
||||
|
@@ -87,7 +87,7 @@ class qBittorrent implements AbstractClientInterface
|
||||
$this->curl->setOpt(CURLOPT_TIMEOUT, 600); // 超时
|
||||
// Authenticate and get cookie, else throw exception
|
||||
if (!$this->authenticate()) {
|
||||
throw new \Exception("Unable to authenticate with Web Api.");
|
||||
throw new \Exception("qBittorrent Unable to authenticate with Web Api.");
|
||||
}
|
||||
}
|
||||
|
||||
|
300
app/Library/Table.php
Normal file
300
app/Library/Table.php
Normal file
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: 大卫
|
||||
* Date: 2020-1-19
|
||||
* Time: 17:44
|
||||
*/
|
||||
namespace IYUU\Library;
|
||||
|
||||
class Table
|
||||
{
|
||||
const ALIGN_LEFT = 1;
|
||||
const ALIGN_RIGHT = 0;
|
||||
const ALIGN_CENTER = 2;
|
||||
|
||||
/**
|
||||
* 头信息数据
|
||||
* @var array
|
||||
*/
|
||||
protected $header = [];
|
||||
|
||||
/**
|
||||
* 头部对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER
|
||||
* @var int
|
||||
*/
|
||||
protected $headerAlign = 1;
|
||||
|
||||
/**
|
||||
* 表格数据(二维数组)
|
||||
* @var array
|
||||
*/
|
||||
protected $rows = [];
|
||||
|
||||
/**
|
||||
* 单元格对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER
|
||||
* @var int
|
||||
*/
|
||||
protected $cellAlign = 1;
|
||||
|
||||
/**
|
||||
* 单元格宽度信息
|
||||
* @var array
|
||||
*/
|
||||
protected $colWidth = [];
|
||||
|
||||
/**
|
||||
* 表格输出样式
|
||||
* @var string
|
||||
*/
|
||||
protected $style = 'default';
|
||||
|
||||
/**
|
||||
* 表格样式定义
|
||||
* @var array
|
||||
*/
|
||||
protected $format = [
|
||||
'compact' => [],
|
||||
'default' => [
|
||||
'top' => ['+', '-', '+', '+'],
|
||||
'cell' => ['|', ' ', '|', '|'],
|
||||
'middle' => ['+', '-', '+', '+'],
|
||||
'bottom' => ['+', '-', '+', '+'],
|
||||
'cross-top' => ['+', '-', '-', '+'],
|
||||
'cross-bottom' => ['+', '-', '-', '+'],
|
||||
],
|
||||
'markdown' => [
|
||||
'top' => [' ', ' ', ' ', ' '],
|
||||
'cell' => ['|', ' ', '|', '|'],
|
||||
'middle' => ['|', '-', '|', '|'],
|
||||
'bottom' => [' ', ' ', ' ', ' '],
|
||||
'cross-top' => ['|', ' ', ' ', '|'],
|
||||
'cross-bottom' => ['|', ' ', ' ', '|'],
|
||||
],
|
||||
'borderless' => [
|
||||
'top' => ['=', '=', ' ', '='],
|
||||
'cell' => [' ', ' ', ' ', ' '],
|
||||
'middle' => ['=', '=', ' ', '='],
|
||||
'bottom' => ['=', '=', ' ', '='],
|
||||
'cross-top' => ['=', '=', ' ', '='],
|
||||
'cross-bottom' => ['=', '=', ' ', '='],
|
||||
],
|
||||
'box' => [
|
||||
'top' => ['┌', '─', '┬', '┐'],
|
||||
'cell' => ['│', ' ', '│', '│'],
|
||||
'middle' => ['├', '─', '┼', '┤'],
|
||||
'bottom' => ['└', '─', '┴', '┘'],
|
||||
'cross-top' => ['├', '─', '┴', '┤'],
|
||||
'cross-bottom' => ['├', '─', '┬', '┤'],
|
||||
],
|
||||
'box-double' => [
|
||||
'top' => ['╔', '═', '╤', '╗'],
|
||||
'cell' => ['║', ' ', '│', '║'],
|
||||
'middle' => ['╠', '─', '╪', '╣'],
|
||||
'bottom' => ['╚', '═', '╧', '╝'],
|
||||
'cross-top' => ['╠', '═', '╧', '╣'],
|
||||
'cross-bottom' => ['╠', '═', '╤', '╣'],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 设置表格头信息 以及对齐方式
|
||||
* @access public
|
||||
* @param array $header 要输出的Header信息
|
||||
* @param int $align 对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER
|
||||
* @return void
|
||||
*/
|
||||
public function setHeader($header, $align = self::ALIGN_LEFT)
|
||||
{
|
||||
$this->header = $header;
|
||||
$this->headerAlign = $align;
|
||||
|
||||
$this->checkColWidth($header);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置输出表格数据 及对齐方式
|
||||
* @access public
|
||||
* @param array $rows 要输出的表格数据(二维数组)
|
||||
* @param int $align 对齐方式 默认1 ALGIN_LEFT 0 ALIGN_RIGHT 2 ALIGN_CENTER
|
||||
* @return void
|
||||
*/
|
||||
public function setRows($rows, $align = self::ALIGN_LEFT)
|
||||
{
|
||||
$this->rows = $rows;
|
||||
$this->cellAlign = $align;
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$this->checkColWidth($row);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查列数据的显示宽度
|
||||
* @access public
|
||||
* @param mixed $row 行数据
|
||||
* @return void
|
||||
*/
|
||||
protected function checkColWidth($row)
|
||||
{
|
||||
if (is_array($row))
|
||||
{
|
||||
foreach ($row as $key => $cell)
|
||||
{
|
||||
if (!isset($this->colWidth[$key]) || strlen($cell) > $this->colWidth[$key])
|
||||
{
|
||||
$this->colWidth[$key] = strlen($cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加一行表格数据
|
||||
* @access public
|
||||
* @param mixed $row 行数据
|
||||
* @param bool $first 是否在开头插入
|
||||
* @return void
|
||||
*/
|
||||
public function addRow($row, $first = false)
|
||||
{
|
||||
if ($first)
|
||||
{
|
||||
array_unshift($this->rows, $row);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->rows[] = $row;
|
||||
}
|
||||
|
||||
$this->checkColWidth($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置输出表格的样式
|
||||
* @access public
|
||||
* @param string $style 样式名
|
||||
* @return void
|
||||
*/
|
||||
public function setStyle($style)
|
||||
{
|
||||
$this->style = isset($this->format[$style]) ? $style : 'default';
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出分隔行
|
||||
* @access public
|
||||
* @param string $pos 位置
|
||||
* @return string
|
||||
*/
|
||||
protected function renderSeparator($pos)
|
||||
{
|
||||
$style = $this->getStyle($pos);
|
||||
$array = [];
|
||||
|
||||
foreach ($this->colWidth as $width)
|
||||
{
|
||||
$array[] = str_repeat($style[1], $width + 2);
|
||||
}
|
||||
|
||||
return $style[0] . implode($style[2], $array) . $style[3] . PHP_EOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出表格头部
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
protected function renderHeader()
|
||||
{
|
||||
$style = $this->getStyle('cell');
|
||||
$content = $this->renderSeparator('top');
|
||||
|
||||
foreach ($this->header as $key => $header)
|
||||
{
|
||||
$array[] = ' ' . str_pad($header, $this->colWidth[$key], $style[1], $this->headerAlign);
|
||||
}
|
||||
|
||||
if (!empty($array))
|
||||
{
|
||||
$content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL;
|
||||
|
||||
if ($this->rows)
|
||||
{
|
||||
$content .= $this->renderSeparator('middle');
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
protected function getStyle($style)
|
||||
{
|
||||
if ($this->format[$this->style])
|
||||
{
|
||||
$style = $this->format[$this->style][$style];
|
||||
}
|
||||
else
|
||||
{
|
||||
$style = [' ', ' ', ' ', ' '];
|
||||
}
|
||||
|
||||
return $style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出表格
|
||||
* @access public
|
||||
* @param array $dataList 表格数据
|
||||
* @return string
|
||||
*/
|
||||
public function render($dataList = [])
|
||||
{
|
||||
if ($dataList)
|
||||
{
|
||||
$this->setRows($dataList);
|
||||
}
|
||||
|
||||
// 输出头部
|
||||
$content = $this->renderHeader();
|
||||
$style = $this->getStyle('cell');
|
||||
|
||||
if ($this->rows)
|
||||
{
|
||||
foreach ($this->rows as $row)
|
||||
{
|
||||
if (is_string($row) && '-' === $row)
|
||||
{
|
||||
$content .= $this->renderSeparator('middle');
|
||||
}
|
||||
elseif (is_scalar($row))
|
||||
{
|
||||
$content .= $this->renderSeparator('cross-top');
|
||||
$array = str_pad($row, 3 * (count($this->colWidth) - 1) + array_reduce($this->colWidth, function ($a, $b) {
|
||||
return $a + $b;
|
||||
}));
|
||||
|
||||
$content .= $style[0] . ' ' . $array . ' ' . $style[3] . PHP_EOL;
|
||||
$content .= $this->renderSeparator('cross-bottom');
|
||||
}
|
||||
else
|
||||
{
|
||||
$array = [];
|
||||
|
||||
foreach ($row as $key => $val)
|
||||
{
|
||||
$array[] = ' ' . str_pad($val, $this->colWidth[$key], ' ', $this->cellAlign);
|
||||
}
|
||||
|
||||
$content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$content .= $this->renderSeparator('bottom');
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
145
app/helper.php
145
app/helper.php
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
|
||||
use IYUU\Library\IFile;
|
||||
use IYUU\Library\Table;
|
||||
|
||||
/**
|
||||
* 调试函数
|
||||
* @param $data
|
||||
@@ -192,6 +196,37 @@ function convertToMB($from)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节数Byte转换为KB、MB、GB、TB
|
||||
*
|
||||
*/
|
||||
function getFilesize($num){
|
||||
$p = 0;
|
||||
$format='bytes';
|
||||
if($num>0 && $num<1024){
|
||||
$p = 0;
|
||||
return number_format($num).' '.$format;
|
||||
}
|
||||
if($num>=1024 && $num<pow(1024, 2)){
|
||||
$p = 1;
|
||||
$format = 'KB';
|
||||
}
|
||||
if ($num>=pow(1024, 2) && $num<pow(1024, 3)) {
|
||||
$p = 2;
|
||||
$format = 'MB';
|
||||
}
|
||||
if ($num>=pow(1024, 3) && $num<pow(1024, 4)) {
|
||||
$p = 3;
|
||||
$format = 'GB';
|
||||
}
|
||||
if ($num>=pow(1024, 4) && $num<pow(1024, 5)) {
|
||||
$p = 3;
|
||||
$format = 'TB';
|
||||
}
|
||||
$num /= pow(1024, $p);
|
||||
return number_format($num, 2).$format;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 种子过滤器
|
||||
* @param string $site 站点标识
|
||||
@@ -285,6 +320,27 @@ function filter($site = '', $torrent = array())
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志记录函数
|
||||
*/
|
||||
function wlog($data='',$name = '',$path = ''){
|
||||
// 数据转换
|
||||
if (is_bool($data)) {
|
||||
$show_data=$data ? 'true' : 'false';
|
||||
} elseif (is_null($data)) {
|
||||
$show_data='null';
|
||||
} else {
|
||||
$show_data=print_r($data, true);
|
||||
}
|
||||
// 写入日志
|
||||
$dir = $path===''? TORRENT_PATH . 'cache' . DS : $path;
|
||||
IFile::mkdir($dir);
|
||||
$myfile = $dir.$name.'.txt';
|
||||
$file_pointer = @fopen($myfile,"a");
|
||||
$worldsnum = @fwrite($file_pointer,$show_data);
|
||||
@fclose($file_pointer);
|
||||
return $worldsnum;
|
||||
}
|
||||
/**
|
||||
* transmission过滤函数,只保留正常做种
|
||||
*/
|
||||
@@ -317,3 +373,92 @@ function object_array($array)
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 奇数
|
||||
*/
|
||||
function oddFilter($var)
|
||||
{
|
||||
// 返回$var最后一个二进制位,
|
||||
// 为1则保留(奇数的二进制的最后一位肯定是1)
|
||||
return($var & 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 偶数
|
||||
*/
|
||||
function evenFilter($var)
|
||||
{
|
||||
// 返回$var最后一个二进制位,
|
||||
// 为0则保留(偶数的二进制的最后一位肯定是0)
|
||||
return(!($var & 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布员签名
|
||||
* 注意:同时配置iyuu.cn与secret时,优先使用secret。
|
||||
*/
|
||||
function sign( $timestamp ){
|
||||
global $configALL;
|
||||
// 爱语飞飞
|
||||
$token = isset($configALL['iyuu.cn']) && $configALL['iyuu.cn'] ? $configALL['iyuu.cn'] : '';
|
||||
// 鉴权
|
||||
$token = isset($configALL['secret']) && $configALL['secret'] ? $configALL['secret'] : $token;
|
||||
return sha1($timestamp . $token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 分离token中的用户uid
|
||||
* token算法:IYUU + uid + T + sha1(openid+time+盐)
|
||||
* @param string $token 用户请求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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示支持的站点列表
|
||||
*/
|
||||
function ShowTableSites($dir = 'Protocols',$filter = array()){
|
||||
// 过滤的文件
|
||||
switch ($dir) {
|
||||
case 'Protocols':
|
||||
$filter = ['axxxx','decodeBase'];
|
||||
break;
|
||||
case 'Rss':
|
||||
$filter = ['AbstractRss'];
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
$data = [];
|
||||
$i = $j = $k = 0;
|
||||
foreach(glob(APP_PATH.$dir.DS.'*.php') as $key => $start_file)
|
||||
{
|
||||
$start_file = str_replace("\\","/",$start_file);
|
||||
$offset = strripos($start_file,'/');
|
||||
if ($offset===false) {
|
||||
$start_file = substr($start_file,0,-4);
|
||||
} else {
|
||||
$start_file = substr($start_file,$offset+1,-4);
|
||||
}
|
||||
// 过滤示例、过滤解码接口
|
||||
if (in_array($start_file, $filter)) {
|
||||
continue;
|
||||
}
|
||||
// 控制多少列
|
||||
if ($i > 4) {
|
||||
$k++;
|
||||
$i = 0;
|
||||
}
|
||||
$i++;
|
||||
$j++;
|
||||
$data[$k][] = $j.". ".$start_file;
|
||||
}
|
||||
//输出表格
|
||||
$table = new Table();
|
||||
$table->setRows($data);
|
||||
echo($table->render());
|
||||
}
|
||||
|
@@ -273,7 +273,7 @@ return array(
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
),
|
||||
// hdbug 序号:32
|
||||
// hddisk.life 序号:32
|
||||
'hdbug' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
|
19
init.php
19
init.php
@@ -3,10 +3,9 @@
|
||||
// 公共入口文件
|
||||
//----------------------------------
|
||||
// 定义目录
|
||||
use IYUU\AutoReseed;
|
||||
|
||||
defined('ROOT_PATH') or define("ROOT_PATH", __DIR__);
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
defined('APP_PATH') or define('APP_PATH', ROOT_PATH.DS.'app'.DS);
|
||||
define('TORRENT_PATH', ROOT_PATH.DS.'torrent'.DS);
|
||||
|
||||
// 严格开发模式
|
||||
@@ -37,14 +36,16 @@ if (file_exists(ROOT_PATH."/config/config.php")) {
|
||||
// 示例配置
|
||||
$configALL = require_once ROOT_PATH . '/config/config.sample.php';
|
||||
}
|
||||
// 读取支持列表
|
||||
if (is_file(ROOT_PATH . "/config/sites.json")) {
|
||||
$sitesJson = file_get_contents(ROOT_PATH . "/config/sites.json");
|
||||
$configALL['sitesALL'] = json_decode($sitesJson, true);
|
||||
}
|
||||
|
||||
require_once ROOT_PATH . '/vendor/autoload.php';
|
||||
|
||||
AutoReseed::init();
|
||||
$hashArray = AutoReseed::get();
|
||||
if (AutoReseed::$move != null) {
|
||||
echo "种子移动完毕,请重新编辑配置,再尝试辅种! \n\n";
|
||||
exit;
|
||||
global $argv;
|
||||
$start_file = str_replace("\\","/",trim($argv[0]));
|
||||
if( substr($start_file,-8)==="init.php" ){
|
||||
require_once __DIR__ . '/iyuu.php';
|
||||
}
|
||||
AutoReseed::call($hashArray);
|
||||
AutoReseed::wechatMessage();
|
||||
|
12
iyuu.php
Normal file
12
iyuu.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/init.php';
|
||||
use IYUU\AutoReseed;
|
||||
|
||||
AutoReseed::init();
|
||||
$hashArray = AutoReseed::get();
|
||||
if (AutoReseed::$move != null) {
|
||||
echo "种子移动完毕,请重新编辑配置,再尝试辅种! \n\n";
|
||||
exit;
|
||||
}
|
||||
AutoReseed::call($hashArray);
|
||||
AutoReseed::wechatMessage();
|
10
readme.md
10
readme.md
@@ -29,11 +29,13 @@ IYUU自动辅种工具(英文名:IYUUAutoReseed),是一款PHP语言编
|
||||
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圣城(已删除)。
|
||||
|
||||
## 运行环境
|
||||
所有具备PHP运行环境的所有平台!官方下载的记得开启crul、fileinfo、mbstring,这3个扩展。
|
||||
例如:Linux、Windows、MacOS
|
||||
所有具备PHP运行环境的所有平台,例如:Linux、Windows、MacOS!
|
||||
|
||||
官方下载的记得开启crul、fileinfo、mbstring,这3个扩展。
|
||||
|
||||
1. Windows下安装php环境:https://www.php.net/downloads
|
||||
|
||||
|
||||
@@ -100,6 +102,8 @@ IYUU自动辅种工具(英文名:IYUUAutoReseed),是一款PHP语言编
|
||||
| 寒山先生 | ¥100元 | 2020年1月9日11:51 |
|
||||
| 王浩淼 | ¥50元 | 2020年1月9日11:53 |
|
||||
| 寒山先生 | ¥100元 | 2020年1月11日11:47 |
|
||||
| 天空(感谢远程指导小意思) | ¥20元 | 2020年1月14日23:11 |
|
||||
| 寒山先生 | ¥200元 | 2020年1月18日12:37 |
|
||||
|
||||
补充说明:
|
||||
|
||||
|
51
wiki/下载最新源码.md
Normal file
51
wiki/下载最新源码.md
Normal file
@@ -0,0 +1,51 @@
|
||||
## 下载最新源码的两种方法
|
||||
### 第一种:下载完整的发行版
|
||||
**github:**[GITHUB仓库 发行版][1]
|
||||
**gitee:**[码云仓库 发行版][2]
|
||||
下载**`Release.zip`**后缀的压缩包,解压缩后即可配置适用。
|
||||
|
||||
### 第二种:git clone下载源码
|
||||
**拉取源码命令,下面两个仓库都可以:**
|
||||
- github:`git clone https://github.com/ledccn/IYUUAutoReseed`
|
||||
- gitee:`git clone https://gitee.com/ledc/IYUUAutoReseed.git`
|
||||
|
||||
----------
|
||||
|
||||
|
||||
**完整命令:**
|
||||
```bash
|
||||
git clone https://github.com/ledccn/IYUUAutoReseed
|
||||
cd IYUUAutoReseed
|
||||
composer install
|
||||
```
|
||||
Windows环境,完整过程演示:
|
||||
![git下载源码composer安装.png][3]
|
||||
```cmd
|
||||
E:\>git clone https://github.com/ledccn/IYUUAutoReseed
|
||||
Cloning into 'IYUUAutoReseed'...
|
||||
remote: Enumerating objects: 189, done.
|
||||
remote: Counting objects: 100% (189/189), done.
|
||||
remote: Compressing objects: 100% (120/120), done.
|
||||
Receiving objects: 97% (814/remote: Total 839 (delta 78), reused 171 (delta 64), pack-reused 650839), 380.00 KiB | 45.0R
|
||||
Receiving objects: 100% (839/839), 419.04 KiB | 50.00 KiB/s, done.
|
||||
Resolving deltas: 100% (468/468), done.
|
||||
|
||||
E:\>cd IYUUAutoReseed
|
||||
|
||||
E:\IYUUAutoReseed>composer install
|
||||
Loading composer repositories with package information
|
||||
Installing dependencies (including require-dev) from lock file
|
||||
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
|
||||
Package operations: 2 installs, 0 updates, 0 removals
|
||||
- Installing curl/curl (2.2.0): Loading from cache
|
||||
- Installing owner888/phpspider (v2.1.6): Loading from cache
|
||||
owner888/phpspider suggests installing ext-pcntl、ext-redis (For better performance. )
|
||||
Generating autoload files
|
||||
|
||||
E:\IYUUAutoReseed>
|
||||
```
|
||||
|
||||
|
||||
[1]: https://github.com/ledccn/IYUUAutoReseed/releases
|
||||
[2]: https://gitee.com/ledc/IYUUAutoReseed/releases
|
||||
[3]: https://www.iyuu.cn/usr/uploads/2020/01/314358689.png
|
@@ -6,7 +6,7 @@ IYUU自动辅种工具、Ourbits双方达成合作,可以对使用接口的用
|
||||
![微信通知1.png][1]
|
||||
![微信通知2.png][2]
|
||||
![微信通知3.png][3]
|
||||
2.复制您的token令牌到`/app/config/config.php`文件内的`iyuu.cn`对应的配置字段,保存。如图:
|
||||
2.复制您的token令牌到`/config/config.php`文件内的`iyuu.cn`对应的配置字段,保存。如图:
|
||||
![微信通知4.png][4]
|
||||
|
||||
### 设置Ourbits:
|
||||
|
@@ -3,7 +3,13 @@ php命令与脚本路径之间是有个空格,请注意!请注意!请注
|
||||
|
||||
|
||||
## IYUU自动辅种命令:
|
||||
`php ./init.php`
|
||||
`php ./iyuu.php`
|
||||
|
||||
|
||||
|
||||
## IYUU自动下载种子之RSS订阅
|
||||
|
||||
`php ./rss.php 站点名`
|
||||
|
||||
|
||||
|
||||
|
16
wiki/常见问题.md
16
wiki/常见问题.md
@@ -81,6 +81,22 @@
|
||||
|
||||
答:请退出登录,在登录时勾选下面两个SSL的选项,登录后复制cookie,重新配置。
|
||||
|
||||
#### 问:IYUU自动辅种失败,怎么排查问题?
|
||||
|
||||
答:1.输入种子链接,手动方法,看看种子是否还在?
|
||||
|
||||
2.手动下载种子,看看是否出现了下载种子的提示页?
|
||||
|
||||
3.瓷器、城市需要cookie辅种,请检查cookie是否配置正确,如果下载出现提示页面,需要更新配置内的cookie、更新cookid!!!
|
||||
|
||||
如果整个站都失败,请按以上步骤排查。
|
||||
|
||||
#### 问:Windows下执行脚本时乱码?
|
||||
|
||||
答:用cmd和powershell执行脚本中文输出乱码,由于我是写php脚本的,非常喜欢国际化的uft8编码。注册表修改有些可以有些不可以,直接在控制面板修改。
|
||||
|
||||
控制面板\时钟和区域\区域\管理\更改系统区域设置\勾选beta版:使用unicode-utf8全球语言支持,保存重启即可(仅支持win10)
|
||||
|
||||
#### 问:如何反馈问题?
|
||||
|
||||
答:1、点击链接加入群聊【IYUU自动辅种交流】:[https://jq.qq.com/?_wv=1027&k=5JOfOlM][1]
|
||||
|
85
wiki/数据清理.md
85
wiki/数据清理.md
@@ -1,46 +1,47 @@
|
||||
## 404数据最后清理时间
|
||||
|标志 | 最后清理时间 | 状态 |
|
||||
| :-: | :-: | ---- |
|
||||
| 兽 | | |
|
||||
|老师 | | |
|
||||
|伊甸园 | | |
|
||||
|CHD | | |
|
||||
|hdzone | | |
|
||||
|港知堂(discfan) | | |
|
||||
|海豚 | | |
|
||||
|oshen | | |
|
||||
|HDU(upxin) | | |
|
||||
|U2 | | |
|
||||
|joyhd | | |
|
||||
|高清街 | | |
|
||||
|HDTIME | | |
|
||||
|hddisk(hdbug) | | |
|
||||
|HDArea | | |
|
||||
|1ptba | | |
|
||||
|烧包 | | |
|
||||
|LeagueHD | | |
|
||||
|聆音 | | |
|
||||
|TLFBits | | |
|
||||
|备胎 | | |
|
||||
|Brobits | | |
|
||||
|52pt | | |
|
||||
| 南洋 | | 已完成 |
|
||||
|映客 | | 已完成 |
|
||||
| ttg | | |
|
||||
|城市 | 2020年1月17日01:48:27 | 已完成 |
|
||||
|萌猫 | 2020年1月16日12:07:12 | 已完成 |
|
||||
|ptmsg | 2020年1月16日12:07:17 | 已完成 |
|
||||
|瓷器 | | |
|
||||
|杜比 | 2020年1月16日11:34:19 | 已完成 |
|
||||
|tccf | 2020年1月17日01:48:36 | 已完成 |
|
||||
|馒头 | | |
|
||||
|春天 | 2020年1月16日00:23:05 | 已完成 |
|
||||
|北洋 | 2020年1月16日00:23:05 | 已完成 |
|
||||
|猫站 | 2020年1月17日01:48:43 | 已完成 |
|
||||
|朋友 | 2020年1月16日00:23:05 | 已完成 |
|
||||
|铂金家 | 2020年1月16日00:23:05 | 已完成 |
|
||||
|家园 | 2020年1月16日00:23:05 | 已完成 |
|
||||
|学校 | 2020年1月16日00:19:24 | 已完成 |
|
||||
| 我堡 | 2020年1月15日13:56:22 | 已完成 |
|
||||
| 天空 | 2020年1月15日20:49:33 | 已完成 |
|
||||
| 1ptba | 2020年1月19日12:00:00 | 已完成 |
|
||||
|52pt | 2020年1月19日12:00:00 | 已完成 |
|
||||
|beitai-备胎 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|brobits | 2020年1月19日12:00:00 | 已完成 |
|
||||
|btschool-学校 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|chdbits-彩虹岛 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|discfan-港知堂 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|dmhy-幼儿园 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|eastgame | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hd4fans-兽 | | 已完成 |
|
||||
|hdarea-HDA | | |
|
||||
|hdbd-伊甸园 | | |
|
||||
|hdbug(hddisk) | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hdchina-瓷器 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hdcity-城市 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hddolby-杜比 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hdhome-家园 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hdsky-天空 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hdstreet | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hdtime-时间 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|hdzone-HDZ | 2020年1月19日12:00:00 | 已完成 |
|
||||
|joyhd | 2020年1月19日12:00:00 | 已完成 |
|
||||
| keepfrds-朋友 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|leaguehd | 2020年1月19日12:00:00 | 已完成 |
|
||||
| m-team-馒头 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|moecat-萌猫 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|nanyangpt-南洋 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|nicept-老师 | | |
|
||||
|opencd-皇后 | | 已完成 |
|
||||
|oshen | 2020年1月19日12:00:00 | 已完成 |
|
||||
|ourbits-我堡 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|pterclub-猫站 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|pthome-铂金家 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|ptmsg | 2020年1月19日12:00:00 | 已完成 |
|
||||
|ptsbao-烧包 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|soulvoice-聆音 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|ssd-春天 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|tjupt-北洋 | 2020年1月19日12:00:00 | 已完成 |
|
||||
|torrentccf-TCCF | 2020年1月19日12:00:00 | 已完成 |
|
||||
| ttg-听听歌 | 2020年1月19日12:00:00 | 已完成 |
|
||||
| upxin | 2020年1月19日12:00:00 | 已完成 |
|
||||
| yingk-映客 | 2020年1月19日12:00:00 | 已完成 |
|
||||
| ziyuan-资源 | | |
|
||||
|
||||
|
@@ -1,3 +1,11 @@
|
||||
### 2020年1月21日
|
||||
|
||||
新增:支持的站点列表json本地化
|
||||
|
||||
新增:在线查询支持站点控制台显示
|
||||
|
||||
新增:Windows系统composer install安装依赖包命令
|
||||
|
||||
### 2020年1月17日
|
||||
|
||||
优化:文件结构,辅种脚本前置检查;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
以下教程以windows为基础进行讲解,其他系统同理。
|
||||
以下教程以windows为基础进行讲解,通用威联通、群晖、铁威马等Linux系统。
|
||||
博客链接:https://www.iyuu.cn/archives/324/
|
||||
## 第一步 下载压缩包
|
||||
从[码云仓库][1],下载最新源码,解压缩到D盘的根目录下。
|
||||
@@ -49,7 +49,7 @@ IYUU自动辅种工具、Ourbits双方达成合作,可以对使用接口的用
|
||||
![微信通知1.png][6]
|
||||
![微信通知2.png][7]
|
||||
![微信通知3.png][8]
|
||||
2.复制您的token令牌到`/app/config/config.php`文件内的`iyuu.cn`对应的配置字段,保存。如图:
|
||||
2.复制您的token令牌到`/config/config.php`文件内的`iyuu.cn`对应的配置字段,保存。如图:
|
||||
![微信通知4.png][9]
|
||||
|
||||
### 设置Ourbits:
|
||||
|
Reference in New Issue
Block a user