VANA/VANA-php/routes/web.php

36 lines
922 B
PHP
Raw Normal View History

2024-10-11 08:02:45 +02:00
<?php
2024-10-11 11:20:39 +02:00
use App\Models\Episode as EpisodeModel;
2024-10-11 08:02:45 +02:00
use App\Subtitles as AppSubtitles;
2024-11-01 09:45:32 +01:00
use App\Helpers;
2024-10-11 08:02:45 +02:00
use Illuminate\Support\Facades\Route;
2024-10-18 17:47:20 +02:00
use Wikidata\Wikidata;
2024-10-29 21:27:29 +01:00
use Podlove\Webvtt\Parser;
use Podlove\Webvtt\ParserException;
2024-10-18 17:47:20 +02:00
use App\Models\Episode;
2024-10-11 08:02:45 +02:00
Route::get('/', function () {
2024-10-18 17:47:20 +02:00
$episodes = Episode::all();
return view('list', ['episodes' => $episodes]);
});
Route::get('/detail/{id}', function(int $id) {
$ep = Episode::find($id);
$title = $ep->title;
$subtitles = $ep->subtitles;
$mediacomposition = json_decode($ep->mediacomposition, 1);
2024-11-01 09:45:32 +01:00
$durationSteps = $mediacomposition['chapterList'][0]['duration'] / 1000 / 10;
2024-10-11 08:02:45 +02:00
2024-10-29 21:27:29 +01:00
$parser = new Podlove\Webvtt\Parser();
$subtitles = $parser->parse($subtitles);
//dump($subtitles);
2024-11-01 09:45:32 +01:00
return view('detail', ['title' => $title, 'subtitles' => $subtitles, 'mediacomposition' => $mediacomposition, 'durationSteps' => $durationSteps]);
2024-10-11 08:02:45 +02:00
});