mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-06-13 04:08:57 +00:00
迁移文件
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,6 +1,8 @@
|
|||||||
/app/torrent
|
/torrent
|
||||||
/config/config.php
|
/config/config.php
|
||||||
/php-7.2.12-nts
|
/php-7.2.12-nts
|
||||||
/*.bat
|
/*.bat
|
||||||
/*.sh
|
/*.sh
|
||||||
/vendor
|
/vendor
|
||||||
|
.idea
|
||||||
|
.php_cs.cache
|
@ -2,27 +2,22 @@
|
|||||||
/**
|
/**
|
||||||
* IYUUAutoReseed自动辅种
|
* IYUUAutoReseed自动辅种
|
||||||
*/
|
*/
|
||||||
use Curl\Curl;
|
namespace IYUU;
|
||||||
|
|
||||||
|
use Curl\Curl;
|
||||||
|
use IYUU\Library\IFile;
|
||||||
|
use IYUU\Library\Oauth;
|
||||||
|
|
||||||
require_once __DIR__ . '/app/init.php';
|
|
||||||
iyuuAutoReseed::init();
|
|
||||||
$hashArray = iyuuAutoReseed::get();
|
|
||||||
if (iyuuAutoReseed::$move != null) {
|
|
||||||
echo "种子移动完毕,请重新编辑配置,再尝试辅种! \n\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
iyuuAutoReseed::call($hashArray);
|
|
||||||
iyuuAutoReseed::wechatMessage();
|
|
||||||
/**
|
/**
|
||||||
* IYUUAutoReseed自动辅种类
|
* IYUUAutoReseed自动辅种类
|
||||||
*/
|
*/
|
||||||
class iyuuAutoReseed
|
class AutoReseed
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 版本号
|
* 版本号
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const VER = '0.1.0';
|
const VER = '20191224.1010';
|
||||||
/**
|
/**
|
||||||
* RPC连接池
|
* RPC连接池
|
||||||
* @var array
|
* @var array
|
||||||
@ -592,40 +587,3 @@ class iyuuAutoReseed
|
|||||||
return ff($text, $desp);
|
return ff($text, $desp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* transmission过滤函数,只保留正常做种
|
|
||||||
*/
|
|
||||||
function filterStatus($v)
|
|
||||||
{
|
|
||||||
return isset($v['status']) && $v['status']===6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* qBittorrent过滤函数,只保留正常做种
|
|
||||||
*/
|
|
||||||
function qbfilterStatus($v)
|
|
||||||
{
|
|
||||||
if (isset($v['state']) && in_array($v['state'], array('uploading','stalledUP','pausedUP','queuedUP','checkingUP','forcedUP'))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//PHP stdClass Object转array
|
|
||||||
function object_array($array)
|
|
||||||
{
|
|
||||||
if (is_object($array)) {
|
|
||||||
$array = (array)$array;
|
|
||||||
}
|
|
||||||
if (is_array($array)) {
|
|
||||||
foreach ($array as $key=>$value) {
|
|
||||||
$array[$key] = object_array($value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $array;
|
|
||||||
}
|
|
||||||
// 对象转数组
|
|
||||||
function object2array(&$object)
|
|
||||||
{
|
|
||||||
return json_decode(json_encode($object), true);
|
|
||||||
}
|
|
13
app/Client/AbstractClientInterface.php
Normal file
13
app/Client/AbstractClientInterface.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: Rhilip
|
||||||
|
* Date: 1/17/2020
|
||||||
|
* Time: 2020
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace IYUU\Client;
|
||||||
|
|
||||||
|
interface AbstractClientInterface
|
||||||
|
{
|
||||||
|
}
|
@ -26,6 +26,10 @@
|
|||||||
* PHP Class support (PHP 5) (PHP 4 might work, untested)
|
* PHP Class support (PHP 5) (PHP 4 might work, untested)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace IYUU\Client\Transmission;
|
||||||
|
|
||||||
|
use IYUU\Client\AbstractClientInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A friendly little version check...
|
* A friendly little version check...
|
||||||
*/
|
*/
|
||||||
@ -43,7 +47,7 @@ if (version_compare(PHP_VERSION, TransmissionRPC::MIN_PHPVER, '<')) {
|
|||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class TransmissionRPC
|
class TransmissionRPC implements AbstractClientInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* User agent used in all http communication
|
* User agent used in all http communication
|
||||||
@ -580,7 +584,7 @@ class TransmissionRPC
|
|||||||
/**
|
/**
|
||||||
* 执行 rpc 请求
|
* 执行 rpc 请求
|
||||||
*
|
*
|
||||||
* @param $method 请求类型/方法, 详见 $this->allowMethods
|
* @param string $method 请求类型/方法, 详见 $this->allowMethods
|
||||||
* @param array $arguments 附加参数, 可选
|
* @param array $arguments 附加参数, 可选
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
@ -727,42 +731,3 @@ class TransmissionRPC
|
|||||||
$this->session_id = null;
|
$this->session_id = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the type of exception the TransmissionRPC class will throw
|
|
||||||
*/
|
|
||||||
class TransmissionRPCException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Exception: Invalid arguments
|
|
||||||
*/
|
|
||||||
const E_INVALIDARG = -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception: Invalid Session-Id
|
|
||||||
*/
|
|
||||||
const E_SESSIONID = -2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception: Error while connecting
|
|
||||||
*/
|
|
||||||
const E_CONNECTION = -3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception: Error 401 returned, unauthorized
|
|
||||||
*/
|
|
||||||
const E_AUTHENTICATION = -4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception constructor
|
|
||||||
*/
|
|
||||||
public function __construct($message = null, $code = 0, Exception $previous = null)
|
|
||||||
{
|
|
||||||
// PHP version 5.3.0 and above support Exception linking
|
|
||||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
|
||||||
parent::__construct($message, $code, $previous);
|
|
||||||
} else {
|
|
||||||
parent::__construct($message, $code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
48
app/Client/Transmission/TransmissionRPCException.php
Normal file
48
app/Client/Transmission/TransmissionRPCException.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: Rhilip
|
||||||
|
* Date: 1/17/2020
|
||||||
|
* Time: 2020
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace IYUU\Client\Transmission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the type of exception the TransmissionRPC class will throw
|
||||||
|
*/
|
||||||
|
class TransmissionRPCException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Exception: Invalid arguments
|
||||||
|
*/
|
||||||
|
const E_INVALIDARG = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception: Invalid Session-Id
|
||||||
|
*/
|
||||||
|
const E_SESSIONID = -2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception: Error while connecting
|
||||||
|
*/
|
||||||
|
const E_CONNECTION = -3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception: Error 401 returned, unauthorized
|
||||||
|
*/
|
||||||
|
const E_AUTHENTICATION = -4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception constructor
|
||||||
|
*/
|
||||||
|
public function __construct($message = null, $code = 0, Exception $previous = null)
|
||||||
|
{
|
||||||
|
// PHP version 5.3.0 and above support Exception linking
|
||||||
|
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
} else {
|
||||||
|
parent::__construct($message, $code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
namespace IYUU\Client\qBittorrent;
|
||||||
|
|
||||||
use Curl\Curl;
|
use Curl\Curl;
|
||||||
|
use IYUU\Client\AbstractClientInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation
|
* https://github.com/qbittorrent/qBittorrent/wiki/Web-API-Documentation
|
||||||
*/
|
*/
|
||||||
class qBittorrent
|
class qBittorrent implements AbstractClientInterface
|
||||||
{
|
{
|
||||||
private $debug;
|
private $debug;
|
||||||
private $url;
|
private $url;
|
@ -4,6 +4,8 @@
|
|||||||
* @version 0.6
|
* @version 0.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace IYUU\Library;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class IFile
|
* @class IFile
|
||||||
* @brief IFile 文件处理类
|
* @brief IFile 文件处理类
|
@ -2,6 +2,8 @@
|
|||||||
/**
|
/**
|
||||||
* IYUU用户注册、认证
|
* IYUU用户注册、认证
|
||||||
*/
|
*/
|
||||||
|
namespace IYUU\Library;
|
||||||
|
|
||||||
use Curl\Curl;
|
use Curl\Curl;
|
||||||
|
|
||||||
class Oauth
|
class Oauth
|
@ -272,51 +272,6 @@ function filter($site = '', $torrent = array())
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 奇数
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* transmission过滤函数,只保留正常做种
|
* transmission过滤函数,只保留正常做种
|
||||||
*/
|
*/
|
||||||
@ -349,8 +304,3 @@ function object_array($array)
|
|||||||
}
|
}
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
// 对象转数组
|
|
||||||
function object2array(&$object)
|
|
||||||
{
|
|
||||||
return json_decode(json_encode($object), true);
|
|
||||||
}
|
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
"curl/curl": "^2.2"
|
"curl/curl": "^2.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap":["app/Class"],
|
"psr-4": {
|
||||||
|
"IYUU\\": "app/"
|
||||||
|
},
|
||||||
"files": ["app/helper.php"]
|
"files": ["app/helper.php"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
<?php return '20191224.1010';
|
|
14
init.php
14
init.php
@ -3,9 +3,11 @@
|
|||||||
// 公共入口文件
|
// 公共入口文件
|
||||||
//----------------------------------
|
//----------------------------------
|
||||||
// 定义目录
|
// 定义目录
|
||||||
|
use IYUU\AutoReseed;
|
||||||
|
|
||||||
defined('ROOT_PATH') or define("ROOT_PATH", __DIR__);
|
defined('ROOT_PATH') or define("ROOT_PATH", __DIR__);
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
define('TORRENT_PATH', APP_PATH.DS.'torrent'.DS);
|
define('TORRENT_PATH', ROOT_PATH.DS.'torrent'.DS);
|
||||||
|
|
||||||
// 严格开发模式
|
// 严格开发模式
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
@ -14,6 +16,7 @@ error_reporting(E_ALL);
|
|||||||
// 永不超时
|
// 永不超时
|
||||||
ini_set('max_execution_time', 0);
|
ini_set('max_execution_time', 0);
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
// 内存限制,如果外面设置的内存比 /etc/php/php-cli.ini 大,就不要设置了
|
// 内存限制,如果外面设置的内存比 /etc/php/php-cli.ini 大,就不要设置了
|
||||||
if (intval(ini_get("memory_limit")) < 1024) {
|
if (intval(ini_get("memory_limit")) < 1024) {
|
||||||
ini_set('memory_limit', '1024M');
|
ini_set('memory_limit', '1024M');
|
||||||
@ -36,3 +39,12 @@ if (file_exists(ROOT_PATH."/config/config.php")) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
require_once ROOT_PATH . '/vendor/autoload.php';
|
require_once ROOT_PATH . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
AutoReseed::init();
|
||||||
|
$hashArray = AutoReseed::get();
|
||||||
|
if (AutoReseed::$move != null) {
|
||||||
|
echo "种子移动完毕,请重新编辑配置,再尝试辅种! \n\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
AutoReseed::call($hashArray);
|
||||||
|
AutoReseed::wechatMessage();
|
Reference in New Issue
Block a user