master
Giò Diani 2025-01-24 19:56:11 +01:00
parent 0460a1f948
commit f6b73be826
11 changed files with 5694 additions and 9928 deletions

View File

@ -0,0 +1,71 @@
<?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();
}
}
}

View File

@ -10,7 +10,7 @@
"isEntry": true "isEntry": true
}, },
"resources/js/app.js": { "resources/js/app.js": {
"file": "assets/app-DFHgb4jS.js", "file": "assets/app-CrWEnB8o.js",
"name": "app", "name": "app",
"src": "resources/js/app.js", "src": "resources/js/app.js",
"isEntry": true "isEntry": true

View File

@ -66,7 +66,6 @@ function setWordCountChart(){
data.forEach((d) => { data.forEach((d) => {
if(parseInt(d.slice(-1)) > max){ if(parseInt(d.slice(-1)) > max){
console.log(d.slice(-1));
max = d.slice(-1); max = d.slice(-1);
} }
}) })
@ -289,14 +288,3 @@ document.addEventListener("DOMContentLoaded", (event) => {
}, },
}); });
}); });
/*
document.querySelector('#timeline-bar').addEventListener('click', e => {
console.log(e.clientX - e.target.offsetLeft);
let x = e.clientX - e.target.offsetLeft;
player.currentTime(calcCurrenttimeByPosition(x));
})
*/

View File

@ -18,6 +18,7 @@ Route::get('/', function () {
Route::get('/detail/{id}', function(int $id) { Route::get('/detail/{id}', function(int $id) {
$eps = EpisodeModel::all()->pluck('id');
$ep = Episode::find($id); $ep = Episode::find($id);
$title = $ep->title; $title = $ep->title;
$subtitles = $ep->subtitles; $subtitles = $ep->subtitles;
@ -57,6 +58,13 @@ Route::get('/detail/{id}', function(int $id) {
$subtitles = $parser->parse($subtitles); $subtitles = $parser->parse($subtitles);
return view('detail', ['title' => $title, 'subtitles' => $subtitles, 'mediacomposition' => $mediacomposition, 'durationSteps' => $durationSteps, 'dom_color' => $ep->viz_data, 'subdata' => $subdata, 'senti_subdata' => $subdata_senti, 'wpm' => $wordsPerMinute, 'topics' => $topics]); return view('detail', ['eps' => $eps, 'title' => $title, 'subtitles' => $subtitles, 'mediacomposition' => $mediacomposition, 'durationSteps' => $durationSteps, 'dom_color' => $ep->viz_data, 'subdata' => $subdata, 'senti_subdata' => $subdata_senti, 'wpm' => $wordsPerMinute, 'topics' => $topics]);
});
Route::get('/detail/{id}/wpm', function(int $id) {
$ep = Episode::find($id);
return response()->json(json_decode($ep->subtitle_data, 1));
}); });

View File

@ -85,7 +85,6 @@ class NormalizeVtt:
d = {"sentences": sentences, "start": times_start, "end": times_end} d = {"sentences": sentences, "start": times_start, "end": times_end}
df = pl.DataFrame(data=d) df = pl.DataFrame(data=d)
DATA_PATH = Path(__file__).parents[4] data_path = Path(__file__).parents[4] / 'data' / ep
data_folder = DATA_PATH / 'data' / ep / 'normalized_vtt.csv' data_path.mkdir(parents=True, exist_ok=True)
df.write_csv(data_path / 'normalized_vtt.csv')
df.write_csv(data_folder)

File diff suppressed because it is too large Load Diff

Binary file not shown.