|
|
@@ -1532,6 +1532,20 @@ class AnimeService
|
|
|
|
|
|
$global_data = is_array($global_data) ? $global_data : [];
|
|
|
$segment_data = is_array($segment_data) ? $segment_data : [];
|
|
|
+
|
|
|
+ // dialogue只能在segment_data中,如果在global_data中则移到segment_data
|
|
|
+ $dialogue_item = null;
|
|
|
+ foreach ($global_data as $key => $item) {
|
|
|
+ if (trim((string)getProp($item, 'name')) === 'dialogue') {
|
|
|
+ $dialogue_item = $item;
|
|
|
+ unset($global_data[$key]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($dialogue_item) {
|
|
|
+ $segment_data[] = $dialogue_item;
|
|
|
+ }
|
|
|
+
|
|
|
$allow_fields = ['dialogue', 'voice_type', 'speed_ratio', 'loudness_ratio', 'emotion_scale'];
|
|
|
$global_update_data = [];
|
|
|
$segment_update_data = [];
|
|
|
@@ -1572,7 +1586,7 @@ class AnimeService
|
|
|
->first();
|
|
|
if ($timbre_info) {
|
|
|
$global_update_data['voice_audio_url'] = getProp($timbre_info, 'audio_url');
|
|
|
- $global_update_data['voice_name'] = getProp($timbre_info, 'timbre_name');
|
|
|
+ $global_update_data['voice_name'] = str_replace('(多情感)', '', getProp($timbre_info, 'timbre_name'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1588,7 +1602,7 @@ class AnimeService
|
|
|
$global_segment_update_data['updated_at'] = $now;
|
|
|
DB::table('mp_episode_segments')
|
|
|
->where('episode_id', $episode_id)
|
|
|
- ->where('voice_name', $target_voice_actor)
|
|
|
+ ->where('voice_actor', $target_voice_actor)
|
|
|
->update($global_segment_update_data);
|
|
|
|
|
|
if ($global_voice_type) {
|
|
|
@@ -1630,8 +1644,8 @@ class AnimeService
|
|
|
if (!empty($global_update_data)) {
|
|
|
$affected_segments = DB::table('mp_episode_segments')
|
|
|
->where('episode_id', $episode_id)
|
|
|
- ->where('voice_name', $target_voice_actor)
|
|
|
- ->select('segment_id', 'dialogue', 'voice_type', 'voice_name', 'emotion', 'emotion_type', 'gender', 'speed_ratio', 'loudness_ratio', 'emotion_scale', 'pitch')
|
|
|
+ ->where('voice_actor', $target_voice_actor)
|
|
|
+ ->select('segment_id', 'video_url', 'dialogue', 'voice_type', 'voice_name', 'emotion', 'emotion_type', 'gender', 'speed_ratio', 'loudness_ratio', 'emotion_scale', 'pitch')
|
|
|
->get();
|
|
|
|
|
|
foreach ($affected_segments as $seg) {
|
|
|
@@ -1650,7 +1664,7 @@ class AnimeService
|
|
|
if (!isset($segments_data[$segment_id])) {
|
|
|
$segment = DB::table('mp_episode_segments')
|
|
|
->where('segment_id', $segment_id)
|
|
|
- ->select('segment_id', 'dialogue', 'voice_type', 'voice_name', 'emotion', 'emotion_type', 'gender', 'speed_ratio', 'loudness_ratio', 'emotion_scale', 'pitch')
|
|
|
+ ->select('segment_id', 'video_url', 'dialogue', 'voice_type', 'voice_name', 'emotion', 'emotion_type', 'gender', 'speed_ratio', 'loudness_ratio', 'emotion_scale', 'pitch')
|
|
|
->first();
|
|
|
|
|
|
if ($segment) {
|
|
|
@@ -1669,6 +1683,8 @@ class AnimeService
|
|
|
if (!isset($segments_data[$sid])) continue;
|
|
|
|
|
|
$segment = $segments_data[$sid];
|
|
|
+ $video_url = getProp($segment, 'video_url');
|
|
|
+ if (!$video_url) continue;
|
|
|
|
|
|
// 构建音频生成参数
|
|
|
$generate_json = [
|
|
|
@@ -1687,6 +1703,7 @@ class AnimeService
|
|
|
// 插入音频合成任务
|
|
|
$task_id = DB::table('mp_dub_video_tasks')->insertGetId([
|
|
|
'alias_segment_id' => $sid,
|
|
|
+ 'video_url' => $video_url,
|
|
|
'generate_status' => '执行中',
|
|
|
'audio_url' => '',
|
|
|
'generate_json' => json_encode($generate_json, 256),
|