72 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Console\Commands;
 | 
						|
 | 
						|
use Illuminate\Console\Command;
 | 
						|
use Illuminate\Support\Facades\Process;
 | 
						|
use App\Models\Episode;
 | 
						|
 | 
						|
class ProcessEpisode extends Command
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * The name and signature of the console command.
 | 
						|
     *
 | 
						|
     * @var string
 | 
						|
     */
 | 
						|
    protected $signature = 'app:process-episode';
 | 
						|
 | 
						|
    /**
 | 
						|
     * The console command description.
 | 
						|
     *
 | 
						|
     * @var string
 | 
						|
     */
 | 
						|
    protected $description = 'Downloads Episodes and generate metadata.';
 | 
						|
 | 
						|
    /**
 | 
						|
     * Execute the console command.
 | 
						|
     */
 | 
						|
    public function handle()
 | 
						|
    {
 | 
						|
 | 
						|
        $eps = Episode::whereNull('subtitle_data')->get();
 | 
						|
 | 
						|
        //dump($eps);
 | 
						|
 | 
						|
        foreach ($eps as $ep) {
 | 
						|
 | 
						|
            $result = Process::path(__DIR__.'/../../../../VANA-python')->forever()->run('./subtitles_processing/.pixi/envs/default/bin/python ./subtitles_processing/src/subtitles_processing/subtitles-processing.py -a normalize -ep '. $ep->id );
 | 
						|
 | 
						|
            echo $result->output();
 | 
						|
 | 
						|
            $result = Process::path(__DIR__.'/../../../../VANA-python')->forever()->run('./subtitles_processing/.pixi/envs/default/bin/python ./subtitles_processing/src/subtitles_processing/sentence_sentiment.py -ep '. $ep->id );
 | 
						|
 | 
						|
            echo $result->output();
 | 
						|
 | 
						|
            $result = Process::path(__DIR__.'/../../../../VANA-python')->forever()->run('./subtitles_processing/.pixi/envs/default/bin/python ./subtitles_processing/src/subtitles_processing/count_words.py -ep '. $ep->id );
 | 
						|
 | 
						|
            echo $result->output();
 | 
						|
 | 
						|
            $result = Process::path(__DIR__.'/../../../../VANA-python')->forever()->run('./subtitles_processing/.pixi/envs/default/bin/python ./subtitles_processing/src/subtitles_processing/topics.py -ep '. $ep->id );
 | 
						|
 | 
						|
            echo $result->output();
 | 
						|
 | 
						|
            $result = Process::path(__DIR__.'/../../../../VANA-python')->forever()->run('./video_processing/.pixi/envs/default/bin/python ./video_processing/src/video_processing.py -a download -ep '. $ep->id );
 | 
						|
 | 
						|
            echo $result->output();
 | 
						|
 | 
						|
            $result = Process::path(__DIR__.'/../../../../VANA-python')->forever()->run('./video_processing/.pixi/envs/default/bin/python ./video_processing/src/video_processing.py -a extract_frames -ep '. $ep->id );
 | 
						|
 | 
						|
            echo $result->output();
 | 
						|
 | 
						|
            $result = Process::path(__DIR__.'/../../../../VANA-python')->forever()->run('./video_colors/.pixi/envs/default/bin/python ./video_colors/src/dominant_colors.py -ep '. $ep->id );
 | 
						|
 | 
						|
            echo $result->output();
 | 
						|
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    }
 | 
						|
}
 |