finish simplification of ids into single value

This commit is contained in:
Chris Kruining 2025-06-05 10:24:37 +02:00
parent 61795fdc5e
commit 7b363964f7
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
10 changed files with 86 additions and 132 deletions

View file

@ -15,10 +15,10 @@ const jellyfinUserId = "a9c51af84bf54578a99ab4dd0ebf0763";
const lookupTable = query(async () => listItemIds(), 'content.lookupTable');
export const getHighlights = () => getContinueWatching(jellyfinUserId);
export const getStream = query(async (type: Entry['type'], id: string, range: string) => {
export const getStream = query(async (id: string, range: string) => {
const table = await lookupTable();
return getItemStream(table[`${type}-${id}`].jellyfin, range);
return getItemStream(table[id].jellyfin, range);
}, 'content.stream');
export const listCategories = query(async (): Promise<Category[]> => {
@ -35,16 +35,16 @@ export const listCategories = query(async (): Promise<Category[]> => {
export const getEntryFromSlug = query(
async (slug: string): Promise<Entry | undefined> => {
const { type, id } = slug.match(/^.+-(?<type>\w+)-(?<id>\w+)$/)?.groups ?? {};
const { id } = slug.match(/^.+-(?<id>\w+)$/)?.groups ?? {};
return getTmdbEntry(type as any, id);
return getTmdbEntry(id);
},
"content.getFromSlug",
);
export const getEntry = query(
async (type: Entry['type'], id: Entry["id"]): Promise<Entry | undefined> => {
return getTmdbEntry(type, id);
async (id: Entry["id"]): Promise<Entry | undefined> => {
return getTmdbEntry(id);
},
"content.get",
);