mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-04-26 04:13:25 +00:00
修复str_replace($key, '', $path, 1);执行错误的bug
This commit is contained in:
parent
04a10295c2
commit
0a7c2120a1
@ -346,18 +346,18 @@ class AutoReseed
|
||||
$id = $result->arguments->torrent_added->id;
|
||||
$name = $result->arguments->torrent_added->name;
|
||||
}
|
||||
print "********RPC添加下载任务成功 [{$result->result}] (id=$id) \n";
|
||||
if ($is_url) {
|
||||
print "种子:".$torrent. "\n";
|
||||
}
|
||||
print "********RPC添加下载任务成功 [{$result->result}] (id=$id) \n";
|
||||
print "名字:".$name."\n\n";
|
||||
return true;
|
||||
} else {
|
||||
$errmsg = isset($result->result) ? $result->result : '未知错误,请稍后重试!';
|
||||
print "-----RPC添加种子任务,失败 [{$errmsg}] \n";
|
||||
if ($is_url) {
|
||||
print "种子:".$torrent. "\n";
|
||||
}
|
||||
print "-----RPC添加种子任务,失败 [{$errmsg}] \n\n";
|
||||
}
|
||||
break;
|
||||
case 'qBittorrent':
|
||||
@ -370,6 +370,9 @@ class AutoReseed
|
||||
$extra_options['filename'] = rand(1, 4294967200).'.torrent';
|
||||
$result = self::$links[$rpcKey]['rpc']->add_metainfo($torrent, $save_path, $extra_options); // 种子元数据添加下载任务
|
||||
}
|
||||
if ($is_url) {
|
||||
print "种子:".$torrent. "\n";
|
||||
}
|
||||
if ($result === 'Ok.') {
|
||||
print "********RPC添加下载任务成功 [{$result}] \n\n";
|
||||
return true;
|
||||
@ -378,7 +381,7 @@ class AutoReseed
|
||||
}
|
||||
break;
|
||||
default:
|
||||
echo '[ERROR] '.$type;
|
||||
echo '[ERROR] '.$type. PHP_EOL. PHP_EOL;
|
||||
break;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@ -396,20 +399,15 @@ class AutoReseed
|
||||
$resArray = array();
|
||||
// 签名
|
||||
$hashArray['timestamp'] = time();
|
||||
// 爱语飞飞token
|
||||
$hashArray['sign'] = Oauth::getSign();
|
||||
$hashArray['version'] = self::VER;
|
||||
// 写请求日志
|
||||
wlog($hashArray, 'hashString');
|
||||
|
||||
if (is_null(self::$move)) {
|
||||
self::reseed($hashArray);
|
||||
self::wechatMessage();
|
||||
} else {
|
||||
self::reseed($hashArray);
|
||||
self::wechatMessage();
|
||||
if ( self::$move!==null ) {
|
||||
self::move($hashArray);
|
||||
}
|
||||
self::reseed($hashArray);
|
||||
self::wechatMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -632,6 +630,8 @@ class AutoReseed
|
||||
echo "正在提交转移信息…… \n";
|
||||
$res = self::$curl->post(self::$apiUrl . self::$endpoints['move'], $hashArray);
|
||||
$resArray = json_decode($res->response, true);
|
||||
// 写日志
|
||||
wlog($resArray, 'move');
|
||||
// 判断返回值
|
||||
if (isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok')) {
|
||||
echo "转移数据返回:成功!!! \n\n";
|
||||
@ -640,22 +640,20 @@ class AutoReseed
|
||||
echo '-----转移请求失败,原因:' .$errmsg. " \n\n";
|
||||
exit(1);
|
||||
}
|
||||
// 写日志
|
||||
wlog($resArray, 'move');
|
||||
// 可辅种站点信息
|
||||
$sites = $resArray['sites'];
|
||||
// 支持站点数量
|
||||
#self::$wechatMsg['sitesCount'] = count($sites);
|
||||
// 按客户端移动 开始
|
||||
foreach (self::$links as $k => $v) {
|
||||
if (empty($resArray['clients_'.$k])) {
|
||||
echo "clients_".$k."没有查询到可辅种数据 \n\n";
|
||||
continue;
|
||||
}
|
||||
if (self::$move!=null && self::$move[0] == $k){
|
||||
echo "clients_".$k."是目标转移客户端,避免冲突,已跳过! \n\n";
|
||||
continue;
|
||||
}
|
||||
if (empty($resArray['clients_'.$k])) {
|
||||
echo "clients_".$k."没有查询到可转移数据 \n\n";
|
||||
continue;
|
||||
}
|
||||
$infohash_Dir = $move = array();
|
||||
// info_hash与下载目录对应表
|
||||
$infohash_Dir = self::$links[$k]['hash'];
|
||||
@ -846,7 +844,7 @@ class AutoReseed
|
||||
case 1: // 减
|
||||
foreach ($pathArray as $key => $val) {
|
||||
if ( strpos($path, $key)===0 ) {
|
||||
return str_replace($key, '', $path, 1);
|
||||
return substr($path, strlen($key));
|
||||
}
|
||||
}
|
||||
return $path;
|
||||
@ -861,7 +859,7 @@ class AutoReseed
|
||||
case 3: // 替换
|
||||
foreach ($pathArray as $key => $val) {
|
||||
if ( strpos($path, $key)===0 ) {
|
||||
return str_replace($key, $val, $path, 1);
|
||||
return $val . substr($path, strlen($key));
|
||||
}
|
||||
}
|
||||
return $path;
|
||||
|
@ -92,6 +92,7 @@ return array(
|
||||
'host' => 'http://127.0.0.1:9091/transmission/rpc', // 警告!注意:transmission/rpc这段别动,你只需要修改 127.0.0.1:9091
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'downloadDir'=> '',
|
||||
),
|
||||
),
|
||||
'workingMode' => 1,
|
||||
|
@ -104,6 +104,10 @@ IYUU自动辅种工具(英文名:IYUUAutoReseed),是一款PHP语言编
|
||||
| 寒山先生 | ¥100元 | 2020年1月11日11:47 |
|
||||
| 天空(感谢远程指导小意思) | ¥20元 | 2020年1月14日23:11 |
|
||||
| 寒山先生 | ¥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 |
|
||||
|
||||
|
||||
补充说明:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user