|
@@ -1586,6 +1586,8 @@ class AnimeController extends BaseController
|
|
|
|
|
|
|
|
// 按照episodeInfo的格式组织数据
|
|
// 按照episodeInfo的格式组织数据
|
|
|
$acts = [];
|
|
$acts = [];
|
|
|
|
|
+ $totalDuration = 0; // 初始化总时长
|
|
|
|
|
+
|
|
|
foreach($allSegments as $segment) {
|
|
foreach($allSegments as $segment) {
|
|
|
$segmentData = [
|
|
$segmentData = [
|
|
|
'segment_id' => getProp($segment, 'segment_id'),
|
|
'segment_id' => getProp($segment, 'segment_id'),
|
|
@@ -1616,6 +1618,18 @@ class AnimeController extends BaseController
|
|
|
'last_frame_url' => getProp($segment, 'last_frame_url'),
|
|
'last_frame_url' => getProp($segment, 'last_frame_url'),
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+ // 计算分镜时长,优先级:video_duration > audio_duration > 默认5秒
|
|
|
|
|
+ $videoDuration = getProp($segment, 'video_duration');
|
|
|
|
|
+ $audioDuration = getProp($segment, 'audio_duration');
|
|
|
|
|
+
|
|
|
|
|
+ if (!empty($videoDuration) && is_numeric($videoDuration)) {
|
|
|
|
|
+ $totalDuration += floatval($videoDuration);
|
|
|
|
|
+ } elseif (!empty($audioDuration) && is_numeric($audioDuration)) {
|
|
|
|
|
+ $totalDuration += floatval($audioDuration);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $totalDuration += 5; // 默认5秒
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$actNumber = getProp($segment, 'act_number');
|
|
$actNumber = getProp($segment, 'act_number');
|
|
|
if (isset($acts[$actNumber])) {
|
|
if (isset($acts[$actNumber])) {
|
|
|
$acts[$actNumber]['segments'][] = $segmentData;
|
|
$acts[$actNumber]['segments'][] = $segmentData;
|
|
@@ -1628,6 +1642,7 @@ class AnimeController extends BaseController
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$episode['acts'] = array_values($acts);
|
|
$episode['acts'] = array_values($acts);
|
|
|
|
|
+ $episode['total_duration'] = intval(round($totalDuration)); // 取整后的总时长
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
echo "data: " . json_encode([
|
|
echo "data: " . json_encode([
|