mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-19 21:03:54 -07:00
misc: Minor improvements (#1866)
* misc: Minor improvements * Update _cleanup.php * Update TorrServerAPI.php * Update TorrServerAPI.php
This commit is contained in:
parent
83c03ae08e
commit
72376532b3
2 changed files with 6 additions and 12 deletions
|
@ -18,6 +18,7 @@ if (php_sapi_name() !== 'cli') {
|
||||||
|
|
||||||
$items = [
|
$items = [
|
||||||
'.github',
|
'.github',
|
||||||
|
'.cliffignore',
|
||||||
'.editorconfig',
|
'.editorconfig',
|
||||||
'.gitignore',
|
'.gitignore',
|
||||||
'.styleci.yml',
|
'.styleci.yml',
|
||||||
|
|
|
@ -47,13 +47,6 @@ class TorrServerAPI
|
||||||
'extension' => '.m3u'
|
'extension' => '.m3u'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Log filename
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private string $logFile = 'torr_server';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TorrServer constructor
|
* TorrServer constructor
|
||||||
*/
|
*/
|
||||||
|
@ -92,7 +85,7 @@ class TorrServerAPI
|
||||||
]);
|
]);
|
||||||
$isSuccess = $curl->httpStatusCode === 200;
|
$isSuccess = $curl->httpStatusCode === 200;
|
||||||
if (!$isSuccess) {
|
if (!$isSuccess) {
|
||||||
bb_log("TorrServer (ERROR) [$this->url]: Response code: {$curl->httpStatusCode} | Content: {$curl->response}\n", $this->logFile);
|
bb_log("TorrServer (ERROR) [$this->url]: Response code: {$curl->httpStatusCode} | Content: {$curl->response}" . LOG_LF);
|
||||||
}
|
}
|
||||||
$curl->close();
|
$curl->close();
|
||||||
|
|
||||||
|
@ -147,7 +140,7 @@ class TorrServerAPI
|
||||||
file_put_contents($m3uFile, $curl->response);
|
file_put_contents($m3uFile, $curl->response);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bb_log("TorrServer (ERROR) [$this->url]: Response code: {$curl->httpStatusCode} | Content: {$curl->response}\n", $this->logFile);
|
bb_log("TorrServer (ERROR) [$this->url]: Response code: {$curl->httpStatusCode} | Content: {$curl->response}" . LOG_LF);
|
||||||
}
|
}
|
||||||
$curl->close();
|
$curl->close();
|
||||||
|
|
||||||
|
@ -187,7 +180,7 @@ class TorrServerAPI
|
||||||
if (unlink($m3uFile)) {
|
if (unlink($m3uFile)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
bb_log("TorrServer (ERROR) [removeM3U()]: Can't unlink file '$m3uFile'\n", $this->logFile);
|
bb_log("TorrServer (ERROR) [removeM3U()]: Can't unlink file '$m3uFile'" . LOG_LF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +222,7 @@ class TorrServerAPI
|
||||||
if ($curl->httpStatusCode === 200 && !empty($response->{$index})) {
|
if ($curl->httpStatusCode === 200 && !empty($response->{$index})) {
|
||||||
CACHE('tr_cache')->set("ffprobe_m3u_$attach_id", $response, 3600);
|
CACHE('tr_cache')->set("ffprobe_m3u_$attach_id", $response, 3600);
|
||||||
} else {
|
} else {
|
||||||
bb_log("TorrServer (ERROR) [$this->url]: Response code: {$curl->httpStatusCode}\n", $this->logFile);
|
bb_log("TorrServer (ERROR) [$this->url]: Response code: {$curl->httpStatusCode}" . LOG_LF);
|
||||||
}
|
}
|
||||||
$curl->close();
|
$curl->close();
|
||||||
}
|
}
|
||||||
|
@ -254,7 +247,7 @@ class TorrServerAPI
|
||||||
$curl->get($this->url . $this->endpoints['stream'], ['link' => $hash]);
|
$curl->get($this->url . $this->endpoints['stream'], ['link' => $hash]);
|
||||||
$isSuccess = $curl->httpStatusCode === 200;
|
$isSuccess = $curl->httpStatusCode === 200;
|
||||||
if (!$isSuccess) {
|
if (!$isSuccess) {
|
||||||
bb_log("TorrServer (ERROR) [$this->url]: Response code: {$curl->httpStatusCode} | Content: {$curl->response}\n", $this->logFile);
|
bb_log("TorrServer (ERROR) [$this->url]: Response code: {$curl->httpStatusCode} | Content: {$curl->response}" . LOG_LF);
|
||||||
}
|
}
|
||||||
$curl->close();
|
$curl->close();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue