mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-06-13 04:08:57 +00:00
修复RPC添加下载任务时,ID获取错误的bug
This commit is contained in:
@ -147,32 +147,52 @@ class Rpc
|
||||
case 1: //负载均衡模式
|
||||
try
|
||||
{
|
||||
$rpcKey = self::$RPC_Key;
|
||||
$type = self::$links[$rpcKey]['type'];
|
||||
echo '选中:负载均衡'.$rpcKey."\n";
|
||||
if( (strpos($torrent,'http://')===0) || (strpos($torrent,'https://')===0) ){
|
||||
echo 'add';
|
||||
$result = self::$links[$rpcKey]['rpc']->add( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子URL添加下载任务
|
||||
}else{
|
||||
echo 'add_metainfo';
|
||||
$result = self::$links[$rpcKey]['rpc']->add_metainfo( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子文件添加下载任务
|
||||
$is_url = false;
|
||||
if( (strpos($torrent,'http://')===0) || (strpos($torrent,'https://')===0) || (strpos($torrent,'magnet:?xt=urn:btih:')===0) ){
|
||||
$is_url = true;
|
||||
}
|
||||
// 负载均衡
|
||||
self::rpcSelect();
|
||||
$rpcKey = self::$RPC_Key;
|
||||
echo '选中:负载均衡'.$rpcKey."\n";
|
||||
self::rpcSelect();
|
||||
// 调试
|
||||
#p($result);
|
||||
// 下载服务器类型 判断
|
||||
$type = self::$links[$rpcKey]['type'];
|
||||
switch($type){
|
||||
case 'transmission':
|
||||
$id = $result->arguments->torrent_added->id;
|
||||
if( $is_url ){
|
||||
echo 'add';
|
||||
$result = self::$links[$rpcKey]['rpc']->add( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子URL添加下载任务
|
||||
}else{
|
||||
echo 'add_metainfo';
|
||||
$result = self::$links[$rpcKey]['rpc']->add_metainfo( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子文件添加下载任务
|
||||
}
|
||||
$id = $name = '';
|
||||
if( isset($result->arguments->torrent_duplicate) ){
|
||||
$id = $result->arguments->torrent_duplicate->id;
|
||||
$name = $result->arguments->torrent_duplicate->name;
|
||||
}elseif( isset($result->arguments->torrent_added) ){
|
||||
$id = $result->arguments->torrent_added->id;
|
||||
$name = $result->arguments->torrent_added->name;
|
||||
}
|
||||
if(!$id){
|
||||
print "-----RPC添加种子任务,失败 [{$result->result}] \n\n";
|
||||
}else{
|
||||
print "********RPC添加下载任务成功 [{$result->result}] (id=$id) \n\n";
|
||||
// 新添加的任务,开始
|
||||
self::$links[$rpcKey]['rpc']->start( $id );
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 'qBittorrent':
|
||||
if( $is_url ){
|
||||
echo 'add';
|
||||
$result = self::$links[$rpcKey]['rpc']->add( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子URL添加下载任务
|
||||
}else{
|
||||
echo 'add_metainfo';
|
||||
$result = self::$links[$rpcKey]['rpc']->add_metainfo( $torrent, self::$links[$rpcKey]['downloadDir'], $extra_options ); // 种子文件添加下载任务
|
||||
}
|
||||
if ($result === 'Ok.') {
|
||||
print "********RPC添加下载任务成功 [{$result}] \n\n";
|
||||
return true;
|
||||
|
@ -348,7 +348,6 @@ class iyuuAutoReseed
|
||||
// 发起请求
|
||||
echo "正在提交辅种信息…… \n";
|
||||
$res = $curl->post(self::$apiUrl . self::$endpoints['reseed'], $hashArray);
|
||||
|
||||
$resArray = json_decode($res->response, true);
|
||||
// 写日志
|
||||
if(true){
|
||||
@ -441,7 +440,6 @@ class iyuuAutoReseed
|
||||
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' . $_url;
|
||||
print "种子下载页:".$_url. "\n";
|
||||
$url = download($_url, $cookie, $userAgent);
|
||||
#$torrentArray = Bencode::decode($url);
|
||||
break;
|
||||
case 'hdcity':
|
||||
if ( empty($configALL[$sites[$sitesID]['site']]['cookie']) ) {
|
||||
@ -453,6 +451,7 @@ class iyuuAutoReseed
|
||||
$userAgent = $configALL['default']['userAgent'];
|
||||
print "种子:".$_url. "\n";
|
||||
if ( isset($configALL[$sites[$sitesID]['site']]['cuhash']) ) {
|
||||
// 已获取cuhash
|
||||
# code...
|
||||
}else {
|
||||
// 获取cuhash
|
||||
|
@ -69,6 +69,10 @@
|
||||
|
||||
答:为减轻服务器压力,推荐间隔3小时以上(太频繁的调用接口,可能被封禁)。
|
||||
|
||||
#### 问:猫站的Tracker为啥是http,而不是https?
|
||||
|
||||
答:请退出登录,在登录时勾选下面两个SSL的选项,登录后复制cookie,重新配置。
|
||||
|
||||
#### 问:如何反馈问题?
|
||||
|
||||
答:1、点击链接加入群聊【IYUU自动辅种交流】:[https://jq.qq.com/?_wv=1027&k=5JOfOlM][1]
|
||||
|
Reference in New Issue
Block a user