diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 03d9549..362816a 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,6 +1,7 @@ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a918c5d..c6d7f61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "@sveltejs/kit": "^1.5.0", "@types/axios": "^0.14.0", "@types/cookie": "^0.5.1", + "@types/node": "^20.3.3", "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", "autoprefixer": "^10.4.14", @@ -2938,9 +2939,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.2.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.6.tgz", - "integrity": "sha512-GQBWUtGoefMEOx/vu+emHEHU5aw6JdDoEtZhoBrHFPZbA/YNRFfN996XbBASEWdvmLSLyv9FKYppYGyZjCaq/g==", + "version": "20.3.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.3.tgz", + "integrity": "sha512-wheIYdr4NYML61AjC8MKj/2jrR/kDQri/CIpVoZwldwhnIrD/j9jIU5bJ8yBKuB2VhpFV7Ab6G2XkBjv9r9Zzw==", "dev": true }, "node_modules/@types/pug": { diff --git a/package.json b/package.json index a5e544a..175bb77 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@sveltejs/kit": "^1.5.0", "@types/axios": "^0.14.0", "@types/cookie": "^0.5.1", + "@types/node": "^20.3.3", "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", "autoprefixer": "^10.4.14", diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000..a2f984f --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1,30 @@ +import type { LayoutServerLoad } from './$types'; +import { + RADARR_API_KEY, + RADARR_BASE_URL, + SONARR_API_KEY, + SONARR_BASE_URL +} from '$env/static/private'; +import { PUBLIC_JELLYFIN_API_KEY, PUBLIC_JELLYFIN_URL } from '$env/static/public'; + +export const load = (async () => { + const isApplicationSetUp = + !!RADARR_API_KEY && + !!RADARR_BASE_URL && + !!SONARR_API_KEY && + !!SONARR_BASE_URL && + !!PUBLIC_JELLYFIN_API_KEY && + !!PUBLIC_JELLYFIN_URL; + + return { + isApplicationSetUp, + missingEnvironmentVariables: { + RADARR_API_KEY: !RADARR_API_KEY, + RADARR_BASE_URL: !RADARR_BASE_URL, + SONARR_API_KEY: !SONARR_API_KEY, + SONARR_BASE_URL: !SONARR_BASE_URL, + PUBLIC_JELLYFIN_API_KEY: !PUBLIC_JELLYFIN_API_KEY, + PUBLIC_JELLYFIN_URL: !PUBLIC_JELLYFIN_URL + } + }; +}) satisfies LayoutServerLoad; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index fbe1b05..26d19ae 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -3,29 +3,26 @@ import Navbar from './components/Navbar/Navbar.svelte'; import VideoPlayer from './components/VideoPlayer/VideoPlayer.svelte'; import { setContext } from 'svelte'; - import { writable } from 'svelte/store'; + import type { LayoutData } from './$types'; + import { initialPlayerState } from './components/VideoPlayer/VideoPlayer'; - let playerState = writable({ visible: false, jellyfinId: '' }); + setContext('player', initialPlayerState); - setContext('player', { - playerState, - close: () => { - playerState.set({ visible: false, jellyfinId: '' }); - }, - streamJellyfinId: (id: string) => { - playerState.set({ visible: true, jellyfinId: id }); - } - }); + export let data: LayoutData; -
- -
- -
- +{#if data.isApplicationSetUp} +
+ +
+ +
+ - - - -
+ + + +
+{:else} +
Application not set up
+{/if} diff --git a/src/routes/components/Card/Card.svelte b/src/routes/components/Card/Card.svelte index c60ec56..1a67386 100644 --- a/src/routes/components/Card/Card.svelte +++ b/src/routes/components/Card/Card.svelte @@ -1,19 +1,15 @@ -
-
+
+
@@ -62,54 +61,46 @@
-
-
- - +
+ + - {#await Promise.all( [data.streamed.available, data.streamed.unavailable, data.streamed.downloading] )} + {#await Promise.all( [data.streamed.available, data.streamed.unavailable, data.streamed.downloading] )} +
+ {#each [...Array(20).keys()] as index (index)} + + {/each} +
+ {:then [available, unavailable, downloading]} + {#if downloading.length > 0} +

Downloading

- {#each [...Array(20).keys()] as index (index)} - + {#each downloading as movie (movie)} + {/each}
- {:then [available, unavailable, downloading]} - {#if downloading.length > 0} -

Downloading

-
- {#each downloading as movie (movie.tmdbId)} - - {/each} -
- {/if} + {/if} - {#if available.length > 0} -

Available

-
- {#each available as movie (movie.tmdbId)} - - {/each} -
- {/if} + {#if available.length > 0} +

Available

+
+ {#each available as movie (movie.tmdbId)} + + {/each} +
+ {/if} - {#if unavailable.length > 0} -

Unavailable

-
- {#each unavailable as movie (movie.tmdbId)} - - {/each} -
- {/if} + {#if unavailable.length > 0} +

Unavailable

+
+ {#each unavailable as movie (movie.tmdbId)} + + {/each} +
+ {/if} - {#if watched.length > 0} -

Watched

- {/if} - {/await} -
+ {#if watched.length > 0} +

Watched

+ {/if} + {/await}
diff --git a/src/routes/library/+server.ts b/src/routes/library/+server.ts deleted file mode 100644 index e69de29..0000000