Merge remote-tracking branch 'origin/php8' into php8

This commit is contained in:
xiaomlove
2025-09-21 14:43:16 +07:00
6 changed files with 57 additions and 28 deletions
+51 -24
View File
@@ -315,19 +315,19 @@ class BdInfoExtra
$video['aspect_ratio'] = $ratioMatches[1]; $video['aspect_ratio'] = $ratioMatches[1];
} }
} else { } else {
// 隐藏视频流,检查是否包含Dolby Vision信息 // 隐藏视频流 - 也作为独立的视频流处理,但标记为隐藏
if (strpos($matches[4], 'Dolby Vision') !== false) { $video[] = [
// 将Dolby Vision信息添加到第一个视频流描述中 'codec' => trim($matches[2]),
if (isset($video[0]['description'])) { 'bitrate' => trim($matches[3]) . ' kbps',
$video[0]['description'] .= ' / ' . trim($matches[4]); 'description' => trim($matches[4]),
} 'hidden' => true
} ];
} }
} }
} }
/** /**
* 提取非英文内容 * 提取字幕和音轨描述中的非英文内容
*/ */
private function extractNonEnglishContent(string $text): array private function extractNonEnglishContent(string $text): array
{ {
@@ -336,6 +336,8 @@ class BdInfoExtra
// 提取所有非英文字符的内容 // 提取所有非英文字符的内容
if (preg_match_all('/[^\x{0000}-\x{007F}]+/u', $text, $matches)) { if (preg_match_all('/[^\x{0000}-\x{007F}]+/u', $text, $matches)) {
foreach ($matches[0] as $match) { foreach ($matches[0] as $match) {
// 去除制表符和括号
$match = preg_replace('/[\s\t\n\r()()【】\[\]]+/u', '', $match);
$match = trim($match); $match = trim($match);
if (!empty($match)) { if (!empty($match)) {
$result['non_english_content'][] = $match; $result['non_english_content'][] = $match;
@@ -478,9 +480,9 @@ class BdInfoExtra
{ {
$profiles = []; $profiles = [];
// 检查所有视频流 // 检查所有视频流,跳过隐藏视频流
foreach ($this->bdInfoArr['video'] as $key => $video) { foreach ($this->bdInfoArr['video'] as $key => $video) {
if (is_array($video) && isset($video['description'])) { if (is_array($video) && isset($video['description']) && !isset($video['hidden'])) {
$description = $video['description']; $description = $video['description'];
if (preg_match('/([^\/]*?(?:profile|high|level|main)[^\/]*?)(?:\s*\/|$)/i', $description, $matches)) { if (preg_match('/([^\/]*?(?:profile|high|level|main)[^\/]*?)(?:\s*\/|$)/i', $description, $matches)) {
$profiles[] = trim($matches[1]); $profiles[] = trim($matches[1]);
@@ -612,27 +614,52 @@ class BdInfoExtra
*/ */
public function getHDRFormat(): string public function getHDRFormat(): string
{ {
// 从第一个视频流获取HDR信息 // 从所有视频流获取HDR信息
$firstVideo = $this->bdInfoArr['video'][0] ?? null; $hdrTypes = [];
$description = $firstVideo['description'] ?? ''; $bitDepths = [];
$hdrFormats = []; $nits = [];
// 从VIDEO描述中提取HDR格式 foreach ($this->bdInfoArr['video'] as $video) {
if (preg_match('/\b(HDR10|HLG|Dolby Vision)\b/i', $description, $matches)) { $description = $video['description'] ?? '';
$hdrFormats[] = $matches[1];
// 从VIDEO描述中提取HDR格式
if (preg_match('/\b(HDR10\+|HDR10|HDR|HLG|Dolby Vision)(?:\s|\/|$)/i', $description, $matches)) {
$hdrTypes[] = $matches[1];
}
// 检查比特深度
if (preg_match('/(\d+)\s+bits/', $description, $matches)) {
$bitDepths[] = $matches[1] . ' bits';
}
// 检查亮度
if (preg_match('/(\d+)nits/', $description, $matches)) {
$nits[] = $matches[1] . 'nits';
}
} }
// 检查比特深度 // 去重并构建结果
if (preg_match('/(\d+)\s+bits/', $description, $matches)) { $result = [];
$hdrFormats[] = $matches[1] . ' bits';
// HDR格式
$hdrTypes = array_unique($hdrTypes);
if (!empty($hdrTypes)) {
$result[] = implode(' / ', $hdrTypes);
} }
// 检查亮 // 比特深
if (preg_match('/(\d+)nits/', $description, $matches)) { $bitDepths = array_unique($bitDepths);
$hdrFormats[] = $matches[1] . 'nits'; if (!empty($bitDepths)) {
$result[] = implode(' / ', $bitDepths);
} }
return implode(' / ', $hdrFormats); // 亮度
$nits = array_unique($nits);
if (!empty($nits)) {
$result[] = implode(' / ', $nits);
}
return implode(' / ', $result);
} }
/** /**
+2 -2
View File
@@ -117,10 +117,10 @@ if ($action == "add")
$commentid = intval($_GET["cid"] ?? 0); $commentid = intval($_GET["cid"] ?? 0);
int_check($commentid,true); int_check($commentid,true);
$res2 = sql_query("SELECT comments.text, users.username FROM comments JOIN users ON comments.user = users.id WHERE comments.id=$commentid") or sqlerr(__FILE__, __LINE__); $res2 = sql_query("SELECT comments.text, users.username FROM comments LEFT JOIN users ON comments.user = users.id WHERE comments.id=$commentid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res2) != 1) if (mysql_num_rows($res2) != 1)
stderr($lang_forums['std_error'], $lang_forums['std_no_comment_id']); stderr($lang_comment['std_error'], $lang_comment['std_no_comment_id']);
$arr2 = mysql_fetch_assoc($res2); $arr2 = mysql_fetch_assoc($res2);
} }
+1
View File
@@ -7,6 +7,7 @@ return [
'user_not_exists' => '(orphaned)', 'user_not_exists' => '(orphaned)',
'time_units' => [ 'time_units' => [
'week' => 'weeks', 'week' => 'weeks',
'hour' => 'hours',
], ],
'select_all' => 'Select all', 'select_all' => 'Select all',
'unselect_all' => 'Unselect all', 'unselect_all' => 'Unselect all',
+1 -1
View File
@@ -96,7 +96,7 @@ return [
'technicalinfo_frame_rate' => '帧率', 'technicalinfo_frame_rate' => '帧率',
'technicalinfo_profile' => '档次', 'technicalinfo_profile' => '档次',
'technicalinfo_format' => '格式', 'technicalinfo_format' => '格式',
'technicalinfo_extras' => '附加内容', 'technicalinfo_extras' => '附加信息',
'technicalinfo_ref_frames' => '参考帧', 'technicalinfo_ref_frames' => '参考帧',
'technicalinfo_audio' => '音轨 #', 'technicalinfo_audio' => '音轨 #',
'technicalinfo_subtitles' => '字幕 #', 'technicalinfo_subtitles' => '字幕 #',
+1
View File
@@ -7,6 +7,7 @@ return [
'user_not_exists' => '(無此帳戶)', 'user_not_exists' => '(無此帳戶)',
'time_units' => [ 'time_units' => [
'week' => '周', 'week' => '周',
'hour' => '小時',
], ],
'select_all' => '全選', 'select_all' => '全選',
'unselect_all' => '全不選', 'unselect_all' => '全不選',
+1 -1
View File
@@ -96,7 +96,7 @@ return [
'technicalinfo_frame_rate' => '幀率', 'technicalinfo_frame_rate' => '幀率',
'technicalinfo_profile' => '檔次', 'technicalinfo_profile' => '檔次',
'technicalinfo_format' => '格式', 'technicalinfo_format' => '格式',
'technicalinfo_extras' => '附加內容', 'technicalinfo_extras' => '附加資訊',
'technicalinfo_ref_frames' => '參考幀', 'technicalinfo_ref_frames' => '參考幀',
'technicalinfo_audio' => '音軌 #', 'technicalinfo_audio' => '音軌 #',
'technicalinfo_subtitles' => '字幕 #', 'technicalinfo_subtitles' => '字幕 #',