API: torrents upload/list

This commit is contained in:
xiaomlove
2025-04-17 01:39:40 +07:00
parent 0d3a46231d
commit 2b029eba10
72 changed files with 2332 additions and 507 deletions
+37 -14
View File
@@ -148,20 +148,25 @@ class TechnicalInformation
public function renderOnDetailsPage()
{
global $lang_functions;
$videos = [
'Runtime' => $this->getRuntime(),
'Resolution' => $this->getResolution(),
'Bitrate' => $this->getBitrate(),
'HDR' => $this->getHDRFormat(),
'Bit depth' => $this->getBitDepth(),
'Frame rate' => $this->getFramerate(),
'Profile' => $this->getProfile(),
'Ref.Frames' => $this->getRefFrame(),
];
$videos = array_filter($videos);
$audios = $this->getAudios();
$subtitles = $this->getSubtitles();
// dd($videos, $audios, $subtitles);
// $videos = [
// 'Runtime' => $this->getRuntime(),
// 'Resolution' => $this->getResolution(),
// 'Bitrate' => $this->getBitrate(),
// 'HDR' => $this->getHDRFormat(),
// 'Bit depth' => $this->getBitDepth(),
// 'Frame rate' => $this->getFramerate(),
// 'Profile' => $this->getProfile(),
// 'Ref.Frames' => $this->getRefFrame(),
// ];
// $videos = array_filter($videos);
// $audios = $this->getAudios();
// $subtitles = $this->getSubtitles();
$summaryInfo = $this->getSummaryInfo();
$videos = $summaryInfo['videos'] ?: [];
$audios = $summaryInfo['audios'] ?: [];
$subtitles = $summaryInfo['subtitles'] ?: [];
// dd($summaryInfo, $videos, $audios, $subtitles);
if (empty($videos) && empty($audios) && empty($subtitles)) {
return sprintf('<div class="nexus-media-info-raw"><pre>%s</pre></div>', $this->mediaInfo);
}
@@ -187,6 +192,24 @@ class TechnicalInformation
return $result;
}
public function getSummaryInfo(): array
{
$videos = [
'Runtime' => $this->getRuntime(),
'Resolution' => $this->getResolution(),
'Bitrate' => $this->getBitrate(),
'HDR' => $this->getHDRFormat(),
'Bit depth' => $this->getBitDepth(),
'Frame rate' => $this->getFramerate(),
'Profile' => $this->getProfile(),
'Ref.Frames' => $this->getRefFrame(),
];
$videos = array_filter($videos) ?: null;
$audios = $this->getAudios() ?: null;
$subtitles = $this->getSubtitles() ?: null;
return compact('videos', 'audios', 'subtitles');
}
private function buildTdTable(array $parts)
{
$table = '<table style="border: none;"><tbody>';