display movie files

This commit is contained in:
maxid
2025-12-21 19:24:35 +01:00
parent 4e8dbdd128
commit f184def9ad
2 changed files with 53 additions and 3 deletions

View File

@@ -2,10 +2,11 @@
import { Separator } from '$lib/components/ui/separator/index.js';
import * as Sidebar from '$lib/components/ui/sidebar/index.js';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
import * as Table from '$lib/components/ui/table/index.js';
import { ImageOff } from 'lucide-svelte';
import { getContext } from 'svelte';
import type { components } from '$lib/api/api';
import { getFullyQualifiedMediaName } from '$lib/utils';
import { getFullyQualifiedMediaName, getTorrentQualityString } from '$lib/utils';
import { page } from '$app/state';
import TorrentTable from '$lib/components/torrent-table.svelte';
import MediaPicture from '$lib/components/media-picture.svelte';
@@ -15,8 +16,10 @@
import { resolve } from '$app/paths';
import * as Card from '$lib/components/ui/card/index.js';
import DeleteMediaDialog from '$lib/components/delete-media-dialog.svelte';
import CheckmarkX from '$lib/components/checkmark-x.svelte';
let movie: components['schemas']['PublicMovie'] = $derived(page.data.movie);
let movieFiles: components['schemas']['PublicMovieFile'][] = $derived(page.data.movieFiles);
let user: () => components['schemas']['UserRead'] = getContext('user');
</script>
@@ -110,6 +113,45 @@
</Card.Root>
</div>
</div>
<div class="flex-1 rounded-xl">
<Card.Root class="h-full w-full">
<Card.Header>
<Card.Title>Movie files</Card.Title>
<Card.Description>
A list of all downloaded/downloading versions of this movie.
</Card.Description>
</Card.Header>
<Card.Content>
<Table.Root>
<Table.Caption>
A list of all downloaded/downloading versions of this movie.
</Table.Caption>
<Table.Header>
<Table.Row>
<Table.Head>Quality</Table.Head>
<Table.Head>File Path Suffix</Table.Head>
<Table.Head>Imported</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
{#each movieFiles as file (file)}
<Table.Row>
<Table.Cell class="w-[50px]">
{getTorrentQualityString(file.quality)}
</Table.Cell>
<Table.Cell class="w-[100px]">
{file.file_path_suffix}
</Table.Cell>
<Table.Cell class="w-[10px] font-medium">
<CheckmarkX state={file.downloaded} />
</Table.Cell>
</Table.Row>
{/each}
</Table.Body>
</Table.Root>
</Card.Content>
</Card.Root>
</div>
<div class="flex-1 rounded-xl">
<Card.Root class="h-full w-full">
<Card.Header>

View File

@@ -2,7 +2,15 @@ import type { PageLoad } from './$types';
import client from '$lib/api';
export const load: PageLoad = async ({ params, fetch }) => {
const { data } = await client.GET('/api/v1/movies/{movie_id}', {
const movie = client.GET('/api/v1/movies/{movie_id}', {
fetch: fetch,
params: {
path: {
movie_id: params.movieId
}
}
});
const files = client.GET('/api/v1/movies/{movie_id}/files', {
fetch: fetch,
params: {
path: {
@@ -11,5 +19,5 @@ export const load: PageLoad = async ({ params, fetch }) => {
}
});
return { movie: data };
return { movie: await movie.then((x) => x.data), movieFiles: await files.then((x) => x.data) };
};