diff --git a/media_manager/tv/router.py b/media_manager/tv/router.py index 8006615..ff45f07 100644 --- a/media_manager/tv/router.py +++ b/media_manager/tv/router.py @@ -22,6 +22,7 @@ from media_manager.tv.schemas import ( SeasonRequestId, UpdateSeasonRequest, RichSeasonRequest, + Season, ) from media_manager.tv.dependencies import ( season_dep, @@ -223,6 +224,15 @@ def update_request( return +@router.get( + "/seasons/{season_id}", + dependencies=[Depends(current_active_user)], + response_model=Season, +) +def get_season_files(season: season_dep) -> Season: + return season + + @router.get( "/seasons/{season_id}/files", dependencies=[Depends(current_active_user)], diff --git a/web/src/lib/components/recommended-shows-carousel.svelte b/web/src/lib/components/recommended-shows-carousel.svelte index e130a05..5b74371 100644 --- a/web/src/lib/components/recommended-shows-carousel.svelte +++ b/web/src/lib/components/recommended-shows-carousel.svelte @@ -14,7 +14,7 @@ }} plugins={[ Autoplay({ - delay: 2000, + delay: 4000, stopOnInteraction: false, stopOnMouseEnter: true, playOnInit: true diff --git a/web/src/routes/dashboard/+page.svelte b/web/src/routes/dashboard/+page.svelte index 97e6f8c..d79e2ad 100644 --- a/web/src/routes/dashboard/+page.svelte +++ b/web/src/routes/dashboard/+page.svelte @@ -33,7 +33,7 @@ Dashboard
-
+

Trending Shows

diff --git a/web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.svelte b/web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.svelte index 2d574b6..1364f7f 100644 --- a/web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.svelte +++ b/web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.svelte @@ -12,12 +12,9 @@ import ShowPicture from "$lib/components/show-picture.svelte"; const apiUrl = env.PUBLIC_API_URL - const SeasonNumber = page.params.SeasonNumber; let seasonFiles: PublicSeasonFile[] = $state(page.data.files); + let season: Season = $state(page.data.season); let show: Show = getContext('show'); - let season: Season = $derived( - show().seasons.find((item) => item.number === parseInt(SeasonNumber)) - ); console.log('loaded files', seasonFiles); @@ -48,14 +45,14 @@

- {getFullyQualifiedShowName(show())} Season {SeasonNumber} + {getFullyQualifiedShowName(show())} Season {season.number}

diff --git a/web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.ts b/web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.ts index 7b9faa9..994e3da 100644 --- a/web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.ts +++ b/web/src/routes/dashboard/tv/[showId=uuid]/[SeasonId=uuid]/+page.ts @@ -6,33 +6,45 @@ const apiUrl = env.PUBLIC_API_URL; export const load: PageLoad = async ({fetch, params}) => { const url = `${apiUrl}/tv/seasons/${params.SeasonId}/files`; + const url2 = `${apiUrl}/tv/seasons/${params.SeasonId}`; + try { - console.log(`Fetching data from: ${url}`); + console.log(`Fetching data from: ${url} and ${url2}`); const response = await fetch(url, { method: 'GET', credentials: 'include' }); + const response2 = await fetch(url2, { + method: 'GET', + credentials: 'include' + }); if (!response.ok) { const errorText = await response.text(); console.error(`API request failed with status ${response.status}: ${errorText}`); - return { - error: `Failed to load TV show files. Status: ${response.status}`, - files: [] - }; } + if (!response2.ok) { + const errorText = await response.text(); + console.error(`API request failed with status ${response.status}: ${errorText}`); + } + + const filesData = await response.json(); + const seasonData = await response2.json(); console.log('received season_files data: ', filesData); + console.log('received season data: ', seasonData); return { - files: filesData + files: filesData, + season: seasonData }; } catch (error) { console.error('An error occurred while fetching TV show files:', error); return { error: `An unexpected error occurred: ${error.message || 'Unknown error'}`, - files: [] + files: [], + season: null }; } };