This commit is contained in:
Lars Behrends
2025-10-19 22:05:21 +02:00
parent 0f95458466
commit 552bb72370
8 changed files with 560 additions and 70 deletions

View File

@@ -54,7 +54,7 @@ class AdminController extends Controller
// Validate sync type based on source type
if ($source['name'] === 'jellyfin') {
$validSyncTypes = ['full', 'incremental', 'all', 'movies', 'tvshows'];
$validSyncTypes = ['full', 'incremental', 'all', 'movies', 'tvshows', 'cleanup'];
if (!in_array($syncType, $validSyncTypes)) {
return $this->json($response, [
'success' => false,

View File

@@ -2,6 +2,7 @@
namespace App\Controllers;
use App\Models\TvShow;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Views\Twig;
@@ -30,14 +31,16 @@ class TvShowController extends Controller
// Get view mode
$viewMode = $queryParams['view'] ?? 'grid'; // grid, list, covers
// For now, return empty arrays since TV Shows aren't implemented yet
$tvshows = [];
$totalCount = 0;
// Get TV shows with pagination and search
$tvshows = TvShow::getAllWithPagination($this->pdo, $page, $perPage, $search);
// Get total count for pagination
$totalCount = TvShow::getTotalCount($this->pdo, $search);
// Calculate pagination info
$totalPages = 0;
$hasNextPage = false;
$hasPrevPage = false;
$totalPages = ceil($totalCount / $perPage);
$hasNextPage = $page < $totalPages;
$hasPrevPage = $page > 1;
return $this->view->render($response, 'tvshows/index.twig', [
'title' => 'TV Shows',
@@ -91,31 +94,9 @@ class TvShowController extends Controller
");
$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
*/
// Get seasons and episodes for this TV show
$tvShowModel = new TvShow($this->pdo, $tvShow);
$seasons = $tvShowModel->getSeasonsWithEpisodes();
return $this->view->render($response, 'tvshows/show.twig', [
'title' => $tvShow['title'],
'tvshow' => $tvShow,