update jellyfin api implementation

This commit is contained in:
Chris Kruining 2025-05-14 13:54:06 +02:00
parent 81491482e4
commit 873677ea04
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
6 changed files with 59362 additions and 7 deletions

8
docker-compose.yml Normal file
View file

@ -0,0 +1,8 @@
services:
jellyfin:
image: stoplight/prism
ports:
- '9003:4010'
volumes:
- './src/features/content/apis:/var/apis'
command: 'mock -h 0.0.0.0 /var/apis/jellyfin.json'

View file

@ -23,6 +23,7 @@
"better-auth": "^1.2.7", "better-auth": "^1.2.7",
"better-sqlite3": "^11.10.0", "better-sqlite3": "^11.10.0",
"open-props": "^1.7.15", "open-props": "^1.7.15",
"openapi-fetch": "^0.13.8",
"sitemap": "^8.0.0", "sitemap": "^8.0.0",
"solid-icons": "^1.1.0", "solid-icons": "^1.1.0",
"solid-js": "^1.9.6", "solid-js": "^1.9.6",

File diff suppressed because it is too large Load diff

View file

@ -19,9 +19,9 @@ const client = createClient<paths>({
}); });
export const TEST = query(async () => { export const TEST = query(async () => {
const userId = "a9c51af84bf54578a99ab4dd0ebf0763"; const userId = "a9c51af8-4bf5-4578-a99a-b4dd0ebf0763";
const itemId = "919dfa97e4dad2758a925d056e590a28"; const itemId = "919dfa97-e4da-d275-8a92-5d056e590a28";
const seriesId = "5230ddbcd9400733dc07e5b8cb7a4f49"; const seriesId = "5230ddbcd-9400-733d-c07e-5b8cb7a4f49";
const { data: seriesData } = await client.GET("/UserItems/{itemId}/UserData", { const { data: seriesData } = await client.GET("/UserItems/{itemId}/UserData", {
params: { params: {
@ -159,7 +159,7 @@ export const getContinueWatching = query(
return []; return [];
} }
const uniqueIds = new Set<string>(data.Items.map(item => item.Type === 'Episode' ? item.SeriesId! : 'MOVIE_ID')); const uniqueIds = new Set<string>(data.Items.map(item => item.Type === 'Episode' ? item.SeriesId! : item.Id));
const results = await Promise.allSettled(uniqueIds.values().map(id => getItem(userId, id)).toArray()); const results = await Promise.allSettled(uniqueIds.values().map(id => getItem(userId, id)).toArray());
assertNoErrors(results); assertNoErrors(results);

View file

@ -3,7 +3,7 @@ import { query } from "@solidjs/router";
import { entries } from "./data"; import { entries } from "./data";
import { getContinueWatching, getItem, TEST } from "./apis/jellyfin"; import { getContinueWatching, getItem, TEST } from "./apis/jellyfin";
const jellyfinUserId = "a9c51af84bf54578a99ab4dd0ebf0763"; const jellyfinUserId = "a9c51af8-4bf5-4578-a99a-b4dd0ebf0763";
export const listCategories = query(async (): Promise<Category[]> => { export const listCategories = query(async (): Promise<Category[]> => {
"use server"; "use server";

View file

@ -9,15 +9,17 @@ import {
import { Show } from "solid-js"; import { Show } from "solid-js";
import css from "./index.module.css"; import css from "./index.module.css";
const highlightId = 'c97185ed-e0cf-4945-9120-9d15bb8e5998';
export const route = { export const route = {
preload: async () => ({ preload: async () => ({
highlight: await getEntry("14"), highlight: await getEntry(highlightId),
categories: await listCategories(), categories: await listCategories(),
}), }),
}; };
export default function Home() { export default function Home() {
const highlight = createAsync(() => getEntry("14")); const highlight = createAsync(() => getEntry(highlightId));
const categories = createAsync(() => listCategories()); const categories = createAsync(() => listCategories());
return ( return (