merge
This commit is contained in:
parent
0eb2e34e60
commit
a15809f4fd
11 changed files with 32770 additions and 82 deletions
32577
src/features/content/apis/jellyfin.generated.d.ts
vendored
Normal file
32577
src/features/content/apis/jellyfin.generated.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
62
src/features/content/apis/jellyfin.ts
Normal file
62
src/features/content/apis/jellyfin.ts
Normal file
|
@ -0,0 +1,62 @@
|
|||
import createClient from "openapi-fetch";
|
||||
import type { paths } from "./jellyfin.generated"; // generated by openapi-typescript
|
||||
import { query } from "@solidjs/router";
|
||||
import { Entry } from "../types";
|
||||
|
||||
const baseUrl = "http://ulmo:8096/";
|
||||
const client = createClient<paths>({
|
||||
baseUrl,
|
||||
headers: {
|
||||
Authorization: `MediaBrowser DeviceId="Streamarr", Token="b3c44db1e31f4349b19d1ff0bc487da2"`,
|
||||
},
|
||||
});
|
||||
|
||||
export const getItem = query(async (userId: string, itemId: string) => {
|
||||
const { data, error } = await client.GET("/Items/{itemId}", {
|
||||
params: {
|
||||
path: {
|
||||
itemId,
|
||||
},
|
||||
query: {
|
||||
userId,
|
||||
hasTmdbInfo: true,
|
||||
recursive: true,
|
||||
includeItemTypes: ["Movie", "Series"],
|
||||
fields: [
|
||||
"ProviderIds",
|
||||
"Genres",
|
||||
"DateLastMediaAdded",
|
||||
"DateCreated",
|
||||
"MediaSources",
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return data?.Items ?? [];
|
||||
}, "jellyfin.getItem");
|
||||
|
||||
export const getContinueWatching = query(
|
||||
async (userId: string): Promise<Entry[]> => {
|
||||
const { data, error } = await client.GET("/Users/{userId}/Items/Resume", {
|
||||
params: {
|
||||
path: {
|
||||
userId,
|
||||
},
|
||||
query: {
|
||||
mediaTypes: ["Video"],
|
||||
fields: ["ProviderIds", "Genres"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const items = (data?.Items ?? []).map(({ Id, Name }) => ({
|
||||
id: Id,
|
||||
title: Name,
|
||||
thumbnail: `${baseUrl}Items/${Id}/Images/Primary`,
|
||||
}));
|
||||
|
||||
return items;
|
||||
},
|
||||
"jellyfin.continueWatching",
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue