mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-05-20 08:25:22 +00:00
增加功能:上次辅种成功的,本次智能跳过;
增加合作站点验证类
This commit is contained in:
parent
9043bcfc8a
commit
cd8612d6f0
44
iyuu.cn.php
44
iyuu.cn.php
@ -20,7 +20,7 @@ class iyuuAutoReseed
|
|||||||
* 版本号
|
* 版本号
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const VER = '2019年12月21日20:26:48';
|
const VER = '0.1.0';
|
||||||
// RPC连接池
|
// RPC连接池
|
||||||
public static $links = array();
|
public static $links = array();
|
||||||
/**
|
/**
|
||||||
@ -35,6 +35,7 @@ class iyuuAutoReseed
|
|||||||
* 缓存路径
|
* 缓存路径
|
||||||
*/
|
*/
|
||||||
public static $cacheDir = TORRENT_PATH.'cache'.DS;
|
public static $cacheDir = TORRENT_PATH.'cache'.DS;
|
||||||
|
public static $cacheHash = TORRENT_PATH.'cachehash'.DS;
|
||||||
/**
|
/**
|
||||||
* API接口配置
|
* API接口配置
|
||||||
*/
|
*/
|
||||||
@ -43,6 +44,7 @@ class iyuuAutoReseed
|
|||||||
'add' => '/api/add',
|
'add' => '/api/add',
|
||||||
'update' => '/api/update',
|
'update' => '/api/update',
|
||||||
'reseed' => '/api/reseed',
|
'reseed' => '/api/reseed',
|
||||||
|
'login' => '/login',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* 退出状态码
|
* 退出状态码
|
||||||
@ -59,11 +61,16 @@ class iyuuAutoReseed
|
|||||||
global $configALL;
|
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";
|
||||||
// 递归删除上次历史记录
|
// 递归删除上次历史记录
|
||||||
IFile::rmdir(self::$cacheDir, true);
|
IFile::rmdir(self::$cacheDir, true);
|
||||||
// 建立目录
|
// 建立目录
|
||||||
IFile::mkdir(self::$cacheDir);
|
IFile::mkdir(self::$cacheDir);
|
||||||
|
IFile::mkdir(self::$cacheHash);
|
||||||
self::links();
|
self::links();
|
||||||
|
// 合作站点自动注册鉴权
|
||||||
|
Oauth::login(self::$apiUrl . self::$endpoints['login']);
|
||||||
|
#exit;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 连接远端RPC服务器
|
* 连接远端RPC服务器
|
||||||
@ -195,11 +202,6 @@ class iyuuAutoReseed
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 写日志:文件句柄
|
|
||||||
$resource = fopen(self::$cacheDir.'hashString.txt', "wb");
|
|
||||||
// 成功:返回写入字节数,失败返回false
|
|
||||||
$worldsnum = fwrite($resource, p($hashArray, false));
|
|
||||||
fclose($resource);
|
|
||||||
return $hashArray;
|
return $hashArray;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -262,13 +264,22 @@ class iyuuAutoReseed
|
|||||||
public static function call($hashArray = array())
|
public static function call($hashArray = array())
|
||||||
{
|
{
|
||||||
global $configALL;
|
global $configALL;
|
||||||
|
|
||||||
$resArray = $sites = array();
|
$resArray = $sites = array();
|
||||||
$curl = new Curl();
|
$curl = new Curl();
|
||||||
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
|
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
|
||||||
// 签名
|
// 签名
|
||||||
$hashArray['timestamp'] = time();
|
$hashArray['timestamp'] = time();
|
||||||
$hashArray['sign'] = sign($hashArray['timestamp']);
|
// 爱语飞飞token
|
||||||
|
$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);
|
||||||
|
}
|
||||||
// 发起请求
|
// 发起请求
|
||||||
echo "正在提交辅种信息…… \n";
|
echo "正在提交辅种信息…… \n";
|
||||||
$res = $curl->post(self::$apiUrl . self::$endpoints['reseed'], $hashArray);
|
$res = $curl->post(self::$apiUrl . self::$endpoints['reseed'], $hashArray);
|
||||||
@ -337,8 +348,23 @@ class iyuuAutoReseed
|
|||||||
// 与客户端现有种子重复
|
// 与客户端现有种子重复
|
||||||
echo '-------与客户端现有种子重复:'.$_url."\n\n";
|
echo '-------与客户端现有种子重复:'.$_url."\n\n";
|
||||||
}else{
|
}else{
|
||||||
|
// 判断上次是否成功添加?
|
||||||
|
if ( is_file(self::$cacheHash . $value['info_hash'].'.txt') ) {
|
||||||
|
echo '-------当前种子上次辅种已成功添加,已跳过!'.$_url."\n\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 把拼接的种子URL,推送给下载器
|
// 把拼接的种子URL,推送给下载器
|
||||||
self::add($k, $url, $downloadDir);
|
$ret = false;
|
||||||
|
$ret = self::add($k, $url, $downloadDir);
|
||||||
|
// 写日志
|
||||||
|
if ($ret) {
|
||||||
|
// 文件句柄
|
||||||
|
$resource = fopen(self::$cacheHash . $value['info_hash'].'.txt', "wb");
|
||||||
|
// 成功:返回写入字节数,失败返回false
|
||||||
|
$worldsnum = fwrite($resource, $url);
|
||||||
|
fclose($resource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// 不辅种
|
// 不辅种
|
||||||
|
@ -20,6 +20,9 @@ IYUU自动辅种工具(英文名:iyuuAutoReseed),是一款PHP语言编
|
|||||||
所有具备PHP运行环境的所有平台!
|
所有具备PHP运行环境的所有平台!
|
||||||
例如:Linux、Windows、MacOS
|
例如:Linux、Windows、MacOS
|
||||||
|
|
||||||
|
## 下载源码
|
||||||
|
- 码云仓库:https://gitee.com/ledc/IYUUAutoReseed
|
||||||
|
|
||||||
## 使用方法
|
## 使用方法
|
||||||
详见Wiki
|
详见Wiki
|
||||||
|
|
||||||
@ -29,6 +32,8 @@ IYUU自动辅种工具(英文名:iyuuAutoReseed),是一款PHP语言编
|
|||||||
## 捐助开发者
|
## 捐助开发者
|
||||||
如果觉得我的付出,节约了您的宝贵时间,请随意打赏一杯咖啡!或者一杯水!
|
如果觉得我的付出,节约了您的宝贵时间,请随意打赏一杯咖啡!或者一杯水!
|
||||||
您所有的打赏将用于服务器续期,增加服务的延续性。
|
您所有的打赏将用于服务器续期,增加服务的延续性。
|
||||||
|
|
||||||
|
|
||||||
![微信打赏.png][2]
|
![微信打赏.png][2]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user