feat:YouTube Shorts AI 자동 생성 시스템 구현 (Veo 3.1 + Gemini)
- GeminiScriptService: 트렌딩 제목/시나리오 생성 - VeoVideoService: Veo 3.1 영상 클립 생성 - TtsService: Google TTS 나레이션 생성 - BgmService: 분위기별 BGM 선택 - VideoAssemblyService: FFmpeg 영상 합성 - VideoGenerationJob: 백그라운드 처리 - Veo3Controller: API 엔드포인트 - React 프론트엔드 (5단계 위저드) - GoogleCloudService.getAccessToken() public 변경 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
85
app/Models/VideoGeneration.php
Normal file
85
app/Models/VideoGeneration.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Scopes\TenantScope;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class VideoGeneration extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'user_id',
|
||||
'keyword',
|
||||
'title',
|
||||
'scenario',
|
||||
'status',
|
||||
'progress',
|
||||
'current_step',
|
||||
'clips_data',
|
||||
'output_path',
|
||||
'cost_usd',
|
||||
'error_message',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'scenario' => 'array',
|
||||
'clips_data' => 'array',
|
||||
'progress' => 'integer',
|
||||
'cost_usd' => 'decimal:4',
|
||||
];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::addGlobalScope(new TenantScope);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 상태 상수
|
||||
*/
|
||||
const STATUS_PENDING = 'pending';
|
||||
|
||||
const STATUS_TITLES_GENERATED = 'titles_generated';
|
||||
|
||||
const STATUS_SCENARIO_READY = 'scenario_ready';
|
||||
|
||||
const STATUS_GENERATING_TTS = 'generating_tts';
|
||||
|
||||
const STATUS_GENERATING_CLIPS = 'generating_clips';
|
||||
|
||||
const STATUS_GENERATING_BGM = 'generating_bgm';
|
||||
|
||||
const STATUS_ASSEMBLING = 'assembling';
|
||||
|
||||
const STATUS_COMPLETED = 'completed';
|
||||
|
||||
const STATUS_FAILED = 'failed';
|
||||
|
||||
/**
|
||||
* 진행 상태 업데이트 헬퍼
|
||||
*/
|
||||
public function updateProgress(string $status, int $progress, string $step): void
|
||||
{
|
||||
$this->update([
|
||||
'status' => $status,
|
||||
'progress' => $progress,
|
||||
'current_step' => $step,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 실패 처리
|
||||
*/
|
||||
public function markFailed(string $errorMessage): void
|
||||
{
|
||||
$this->update([
|
||||
'status' => self::STATUS_FAILED,
|
||||
'error_message' => $errorMessage,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user