mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
...
This commit is contained in:
@@ -62,11 +62,68 @@ class TvShowController extends Controller
|
||||
{
|
||||
$tvShowId = (int) $args['id'];
|
||||
|
||||
// For now, return a placeholder since TV Shows aren't implemented yet
|
||||
// Get TV show details
|
||||
$stmt = $this->pdo->prepare("
|
||||
SELECT t.*, s.display_name as source_name
|
||||
FROM tv_shows t
|
||||
JOIN sources s ON t.source_id = s.id
|
||||
WHERE t.id = :id
|
||||
");
|
||||
$stmt->execute(['id' => $tvShowId]);
|
||||
$tvShow = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$tvShow) {
|
||||
return $response->withStatus(404);
|
||||
}
|
||||
|
||||
// Decode metadata and other JSON fields
|
||||
$metadata = json_decode($tvShow['metadata'] ?? '{}', true);
|
||||
$cast = json_decode($tvShow['cast'] ?? '[]', true);
|
||||
$genre = json_decode($tvShow['genre'] ?? '[]', true);
|
||||
|
||||
// Get actors for this TV show
|
||||
$stmt = $this->pdo->prepare("
|
||||
SELECT a.*
|
||||
FROM actors a
|
||||
JOIN actor_tv_show ats ON a.id = ats.actor_id
|
||||
WHERE ats.tv_show_id = :tv_show_id
|
||||
ORDER BY a.name ASC
|
||||
");
|
||||
$stmt->execute(['tv_show_id' => $tvShowId]);
|
||||
$actors = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
/*
|
||||
// Get seasons for this TV show
|
||||
$stmt = $this->pdo->prepare("
|
||||
SELECT * FROM tv_seasons
|
||||
WHERE tv_show_id = :tv_show_id
|
||||
ORDER BY season_number ASC
|
||||
");
|
||||
$stmt->execute(['tv_show_id' => $tvShowId]);
|
||||
$seasons = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
*//*
|
||||
// Get episodes for each season
|
||||
foreach ($seasons as &$season) {
|
||||
$stmt = $this->pdo->prepare("
|
||||
SELECT * FROM tv_episodes
|
||||
WHERE tv_show_id = :tv_show_id AND season_number = :season_number
|
||||
ORDER BY episode_number ASC
|
||||
");
|
||||
$stmt->execute([
|
||||
'tv_show_id' => $tvShowId,
|
||||
'season_number' => $season['season_number']
|
||||
]);
|
||||
$season['episodes'] = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
unset($season); // Unset reference
|
||||
*/
|
||||
return $this->view->render($response, 'tvshows/show.twig', [
|
||||
'title' => 'TV Show Details',
|
||||
'tvshow' => ['id' => $tvShowId, 'title' => 'Coming Soon'],
|
||||
'message' => 'TV show details page is not yet implemented.'
|
||||
'title' => $tvShow['title'],
|
||||
'tvshow' => $tvShow,
|
||||
'metadata' => $metadata,
|
||||
'cast' => $cast,
|
||||
'genre' => $genre,
|
||||
'actors' => $actors,
|
||||
'seasons' => $seasons
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user