mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-04-26 12:23:24 +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;
|
$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. "\n";
|
||||||
}
|
}
|
||||||
|
print "********RPC添加下载任务成功 [{$result->result}] (id=$id) \n";
|
||||||
print "名字:".$name."\n\n";
|
print "名字:".$name."\n\n";
|
||||||
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. "\n";
|
||||||
}
|
}
|
||||||
|
print "-----RPC添加种子任务,失败 [{$errmsg}] \n\n";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'qBittorrent':
|
case 'qBittorrent':
|
||||||
@ -370,6 +370,9 @@ 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. "\n";
|
||||||
|
}
|
||||||
if ($result === 'Ok.') {
|
if ($result === 'Ok.') {
|
||||||
print "********RPC添加下载任务成功 [{$result}] \n\n";
|
print "********RPC添加下载任务成功 [{$result}] \n\n";
|
||||||
return true;
|
return true;
|
||||||
@ -378,7 +381,7 @@ class AutoReseed
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
echo '[ERROR] '.$type;
|
echo '[ERROR] '.$type. PHP_EOL. PHP_EOL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -396,20 +399,15 @@ class AutoReseed
|
|||||||
$resArray = array();
|
$resArray = array();
|
||||||
// 签名
|
// 签名
|
||||||
$hashArray['timestamp'] = time();
|
$hashArray['timestamp'] = time();
|
||||||
// 爱语飞飞token
|
|
||||||
$hashArray['sign'] = Oauth::getSign();
|
$hashArray['sign'] = Oauth::getSign();
|
||||||
$hashArray['version'] = self::VER;
|
$hashArray['version'] = self::VER;
|
||||||
// 写请求日志
|
// 写请求日志
|
||||||
wlog($hashArray, 'hashString');
|
wlog($hashArray, 'hashString');
|
||||||
|
if ( self::$move!==null ) {
|
||||||
if (is_null(self::$move)) {
|
|
||||||
self::reseed($hashArray);
|
|
||||||
self::wechatMessage();
|
|
||||||
} else {
|
|
||||||
self::reseed($hashArray);
|
|
||||||
self::wechatMessage();
|
|
||||||
self::move($hashArray);
|
self::move($hashArray);
|
||||||
}
|
}
|
||||||
|
self::reseed($hashArray);
|
||||||
|
self::wechatMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -632,6 +630,8 @@ class AutoReseed
|
|||||||
echo "正在提交转移信息…… \n";
|
echo "正在提交转移信息…… \n";
|
||||||
$res = self::$curl->post(self::$apiUrl . self::$endpoints['move'], $hashArray);
|
$res = self::$curl->post(self::$apiUrl . self::$endpoints['move'], $hashArray);
|
||||||
$resArray = json_decode($res->response, true);
|
$resArray = json_decode($res->response, true);
|
||||||
|
// 写日志
|
||||||
|
wlog($resArray, 'move');
|
||||||
// 判断返回值
|
// 判断返回值
|
||||||
if (isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok')) {
|
if (isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok')) {
|
||||||
echo "转移数据返回:成功!!! \n\n";
|
echo "转移数据返回:成功!!! \n\n";
|
||||||
@ -640,22 +640,20 @@ class AutoReseed
|
|||||||
echo '-----转移请求失败,原因:' .$errmsg. " \n\n";
|
echo '-----转移请求失败,原因:' .$errmsg. " \n\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
// 写日志
|
|
||||||
wlog($resArray, 'move');
|
|
||||||
// 可辅种站点信息
|
// 可辅种站点信息
|
||||||
$sites = $resArray['sites'];
|
$sites = $resArray['sites'];
|
||||||
// 支持站点数量
|
// 支持站点数量
|
||||||
#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."没有查询到可辅种数据 \n\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (self::$move!=null && self::$move[0] == $k){
|
if (self::$move!=null && self::$move[0] == $k){
|
||||||
echo "clients_".$k."是目标转移客户端,避免冲突,已跳过! \n\n";
|
echo "clients_".$k."是目标转移客户端,避免冲突,已跳过! \n\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (empty($resArray['clients_'.$k])) {
|
||||||
|
echo "clients_".$k."没有查询到可转移数据 \n\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$infohash_Dir = $move = array();
|
$infohash_Dir = $move = array();
|
||||||
// info_hash与下载目录对应表
|
// info_hash与下载目录对应表
|
||||||
$infohash_Dir = self::$links[$k]['hash'];
|
$infohash_Dir = self::$links[$k]['hash'];
|
||||||
@ -846,7 +844,7 @@ class AutoReseed
|
|||||||
case 1: // 减
|
case 1: // 减
|
||||||
foreach ($pathArray as $key => $val) {
|
foreach ($pathArray as $key => $val) {
|
||||||
if ( strpos($path, $key)===0 ) {
|
if ( strpos($path, $key)===0 ) {
|
||||||
return str_replace($key, '', $path, 1);
|
return substr($path, strlen($key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $path;
|
return $path;
|
||||||
@ -861,7 +859,7 @@ class AutoReseed
|
|||||||
case 3: // 替换
|
case 3: // 替换
|
||||||
foreach ($pathArray as $key => $val) {
|
foreach ($pathArray as $key => $val) {
|
||||||
if ( strpos($path, $key)===0 ) {
|
if ( strpos($path, $key)===0 ) {
|
||||||
return str_replace($key, $val, $path, 1);
|
return $val . substr($path, strlen($key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $path;
|
return $path;
|
||||||
|
@ -92,6 +92,7 @@ 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' => '',
|
||||||
|
'downloadDir'=> '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'workingMode' => 1,
|
'workingMode' => 1,
|
||||||
|
@ -104,6 +104,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 |
|
||||||
|
|
||||||
|
|
||||||
补充说明:
|
补充说明:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user