diff --git a/src/components/iconLink/index.tsx b/src/components/iconLink/index.tsx
index d5eeffd..6347b6c 100644
--- a/src/components/iconLink/index.tsx
+++ b/src/components/iconLink/index.tsx
@@ -1,4 +1,4 @@
-import { Link, Typography } from "@mui/material";
+import { Link, Tooltip } from "@mui/material";
import React, { memo } from "react";
import anidbIcon from "../../assets/icons/anidb.png";
@@ -12,54 +12,49 @@ import tmdbIcon from "../../assets/icons/themoviedatabase.svg";
import traktIcon from "../../assets/icons/trakt.svg";
import tvMazeIcon from "../../assets/icons/tvmaze.png";
-const knownIcons = [
- "imdb",
- "themoviedb",
- "trakt",
- "musicbrainz",
- "thetvdb",
- "anidb",
- "anilist",
- "tvmaze",
- "theaudiodb",
- "kitsu",
+/**
+ * Provider icons keyed by the start of the normalized link name, so variants like
+ * "TMDB"/"TheMovieDb", "TVDB"/"TheTVDB" or "MusicBrainz Artist" all match.
+ */
+const providerIcons: [prefixes: string[], icon: string][] = [
+ [["imdb"], imdbIcon],
+ [["tmdb", "themoviedb"], tmdbIcon],
+ [["tvdb", "thetvdb"], tvDbIcon],
+ [["trakt"], traktIcon],
+ [["musicbrainz"], musicBrainzIcon],
+ [["anidb"], anidbIcon],
+ [["anilist"], anilistIcon],
+ [["tvmaze"], tvMazeIcon],
+ [["theaudiodb", "audiodb"], audioDBIcon],
+ [["kitsu"], kitsuIcon],
];
+const getProviderIcon = (name: string) => {
+ const normalized = name.toLocaleLowerCase().replace(/[^a-z0-9]/g, "");
+ return providerIcons.find(([prefixes]) =>
+ prefixes.some((prefix) => normalized.startsWith(prefix)),
+ )?.[1];
+};
+
const IconLink = memo(({ name, url }: { name: string; url: string }) => {
+ const icon = getProviderIcon(name);
return (
-
- {name.toLocaleLowerCase() === "imdb" &&
}
- {name.toLocaleLowerCase() === "themoviedb" && (
-
- )}
- {name.toLocaleLowerCase() === "trakt" && (
-
- )}
- {name.toLocaleLowerCase() === "musicbrainz" && (
-
- )}
- {name.toLocaleLowerCase() === "thetvdb" && (
-
- )}
- {name.toLocaleLowerCase() === "anidb" && (
-
- )}
- {name.toLocaleLowerCase() === "anilist" && (
-
- )}
- {name.toLocaleLowerCase() === "tvmaze" && (
-
- )}
- {name.toLocaleLowerCase() === "theaudiodb" && (
-
- )}
- {name.toLocaleLowerCase() === "kitsu" && (
-
- )}
- {!knownIcons.includes(name.toLocaleLowerCase()) && (
- {name}
- )}
-
+
+
+ {icon ? (
+
+ ) : (
+
+ link
+
+ )}
+
+
);
});
diff --git a/src/components/itemDetail/itemDetail.scss b/src/components/itemDetail/itemDetail.scss
index d0e9053..b3ccad2 100644
--- a/src/components/itemDetail/itemDetail.scss
+++ b/src/components/itemDetail/itemDetail.scss
@@ -208,6 +208,16 @@
filter: brightness(0.5);
transition: filter $transition-time-default;
}
+ &-generic {
+ display: block;
+ font-size: 2em !important;
+ color: white;
+ opacity: 0.5;
+ transition: opacity $transition-time-default;
+ }
+ &:hover > &-generic {
+ opacity: 1;
+ }
}
.item {
diff --git a/src/components/notices/errorNotice/errorNotice.tsx b/src/components/notices/errorNotice/errorNotice.tsx
index 8b00872..f82549e 100644
--- a/src/components/notices/errorNotice/errorNotice.tsx
+++ b/src/components/notices/errorNotice/errorNotice.tsx
@@ -31,15 +31,16 @@ export const ErrorNotice = ({ error }: { error?: Error }) => {
Something went wrong.
{
maxHeight: "20em",
overflow: "auto",
marginTop: "1em",
- // opacity: 0.6,
+ whiteSpace: "pre-wrap",
}}
- color="gray"
sx={{
+ color: "grey.400",
fontFamily: "JetBrains Mono Variable",
- fontWeight: 100,
}}
>
- {JSON.stringify(error?.stack)}
+ {error
+ ? error.stack || `${error.name}: ${error.message}`
+ : "Unknown error"}
);
diff --git a/src/components/playback/videoPlayer/bubbleSlider/index.tsx b/src/components/playback/videoPlayer/bubbleSlider/index.tsx
index e26a38f..d6a6e17 100644
--- a/src/components/playback/videoPlayer/bubbleSlider/index.tsx
+++ b/src/components/playback/videoPlayer/bubbleSlider/index.tsx
@@ -190,7 +190,7 @@ const BubbleSlider = () => {
const backgroundOffsetY = -(imageOffsetY * trickplayResolution?.Height);
const imgUrlParamsObject: Record = {
- api_key: String(api?.accessToken),
+ ApiKey: String(api?.accessToken),
MediaSourceId: mediaSource.id ?? "",
};
const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString();
diff --git a/src/components/playback/videoPlayer/settingsMenu.tsx b/src/components/playback/videoPlayer/settingsMenu.tsx
index 099e453..18fec06 100644
--- a/src/components/playback/videoPlayer/settingsMenu.tsx
+++ b/src/components/playback/videoPlayer/settingsMenu.tsx
@@ -1,5 +1,6 @@
import {
MenuItem,
+ MenuList,
Popover,
Switch,
TextField,
@@ -144,16 +145,18 @@ const VideoPlayerSettingsMenu = ({
))}
-
+
+
+
);
};
diff --git a/src/routes/_api/home/index.tsx b/src/routes/_api/home/index.tsx
index 411088c..b3e3ce7 100644
--- a/src/routes/_api/home/index.tsx
+++ b/src/routes/_api/home/index.tsx
@@ -1,4 +1,4 @@
-import { useQueries, useSuspenseQuery } from "@tanstack/react-query";
+import { useSuspenseQuery } from "@tanstack/react-query";
import React, { useCallback, useMemo } from "react";
import "./home.scss";
@@ -24,25 +24,11 @@ import Carousel from "@/components/carousel";
import CircularPageLoadingAnimation from "@/components/circularPageLoadingAnimation";
import { LatestMediaSection } from "@/components/layouts/homeSection/latestMediaSection";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
-import {
- getLatestItemsQueryOptions,
- getLibraryLatestQueryOptions,
-} from "@/utils/queries/items";
+import { getLatestItemsQueryOptions } from "@/utils/queries/items";
import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useCentralStore } from "@/utils/store/central";
-const heroItemTypes = new Set([
- BaseItemKind.Movie,
- BaseItemKind.Series,
- BaseItemKind.Episode,
- BaseItemKind.MusicAlbum,
-]);
-
-const combineLibraryLatest = (
- results: { data?: BaseItemDto[] | null }[],
-): BaseItemDto[][] => results.map((result) => result.data ?? []);
-
export const Route = createFileRoute("/_api/home/")({
component: Home,
pendingComponent: () => ,
@@ -141,28 +127,14 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
}
}, [libraries.data?.Items?.length]);
- // The per-library "latest" rows; shares cache entries with LatestMediaSection.
- const libraryLatest = useQueries({
- queries: (latestMediaLibs ?? []).map((lib) =>
- getLibraryLatestQueryOptions(api, user.Id, lib.Id),
- ),
- combine: combineLibraryLatest,
- });
-
- // Some servers return nothing for the global /Items/Latest query, so fall back to
- // interleaving the per-library results (each already newest-first).
- const heroItems = useMemo(() => {
- if (latestMedia.data?.length) return latestMedia.data;
- const items: BaseItemDto[] = [];
- const longest = Math.max(0, ...libraryLatest.map((list) => list.length));
- for (let index = 0; index < longest; index++) {
- for (const list of libraryLatest) {
- const item = list[index];
- if (item?.Type && heroItemTypes.has(item.Type)) items.push(item);
- }
- }
- return items.slice(0, 16);
- }, [latestMedia.data, libraryLatest]);
+ const heroItems = useMemo(
+ () =>
+ latestMedia.data?.filter(
+ (item) =>
+ item.Type === BaseItemKind.Movie || item.Type === BaseItemKind.Series,
+ ) ?? [],
+ [latestMedia.data],
+ );
const navigate = useNavigate();
diff --git a/src/routes/_api/player/index.tsx b/src/routes/_api/player/index.tsx
index 1fd0610..ed7cf1f 100644
--- a/src/routes/_api/player/index.tsx
+++ b/src/routes/_api/player/index.tsx
@@ -57,7 +57,7 @@ function addSubtitleTrackToReactPlayer(
const track = document.createElement("track");
const separator = subtitleTracks.url.includes("?") ? "&" : "?";
- const urlParams = apiKey ? `${separator}api_key=${apiKey}` : "";
+ const urlParams = apiKey ? `${separator}ApiKey=${apiKey}` : "";
track.src = `${baseUrl}${subtitleTracks.url}${urlParams}`;
track.kind = "subtitles";
track.srclang = reqSubTrack.Language ?? "en";
@@ -458,7 +458,7 @@ export function VideoPlayer() {
let pgsRenderer: PgsRenderer | undefined;
const apiKey = api?.accessToken;
const separator = mediaSource.subtitle.url?.includes("?") ? "&" : "?";
- const urlParams = apiKey ? `${separator}api_key=${apiKey}` : "";
+ const urlParams = apiKey ? `${separator}ApiKey=${apiKey}` : "";
if (
mediaSource.subtitle.format === "ass" ||
diff --git a/src/routes/_api/player/photos.tsx b/src/routes/_api/player/photos.tsx
index 85e63f3..cf164fe 100644
--- a/src/routes/_api/player/photos.tsx
+++ b/src/routes/_api/player/photos.tsx
@@ -105,7 +105,7 @@ function PhotosPlayer() {
if (pathToSave) {
download(
- `${api?.basePath}/Items/${currentPhoto?.Id}/Download?api_key=${api?.accessToken}`,
+ `${api?.basePath}/Items/${currentPhoto?.Id}/Download?ApiKey=${api?.accessToken}`,
pathToSave,
);
enqueueSnackbar("Image download queued.", { variant: "info" });
@@ -122,7 +122,7 @@ function PhotosPlayer() {
key={currentPhoto?.Id ?? "noPhoto"}
src={
currentPhoto
- ? `${api?.basePath}/Items/${currentPhoto.Id}/Download?api_key=${api?.accessToken}`
+ ? `${api?.basePath}/Items/${currentPhoto.Id}/Download?ApiKey=${api?.accessToken}`
: brokenImage
}
alt="Item"
diff --git a/src/utils/queries/items.ts b/src/utils/queries/items.ts
index 2688858..1d39d76 100644
--- a/src/utils/queries/items.ts
+++ b/src/utils/queries/items.ts
@@ -1,5 +1,11 @@
import type { Api } from "@jellyfin/sdk";
-import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
+import {
+ BaseItemKind,
+ ItemFields,
+ ItemSortBy,
+ LocationType,
+ SortOrder,
+} from "@jellyfin/sdk/lib/generated-client";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import { queryOptions } from "@tanstack/react-query";
@@ -51,7 +57,7 @@ export const getLatestItemsQueryOptions = (
if (!userId) {
throw Error("User ID is not defined");
}
- const media = await getLibraryApi(api).getLatestMedia({
+ const request = {
userId: userId,
fields: [
ItemFields.Overview,
@@ -61,15 +67,25 @@ export const getLatestItemsQueryOptions = (
ItemFields.MediaStreams,
ItemFields.MediaSources,
],
- includeItemTypes: [
- BaseItemKind.Movie,
- BaseItemKind.Series,
- BaseItemKind.MusicAlbum,
- ],
+ includeItemTypes: [BaseItemKind.Movie, BaseItemKind.Series],
enableUserData: true,
enableImages: true,
+ };
+ const media = await getLibraryApi(api).getLatestMedia(request);
+ if (media.data.length > 0) {
+ return media.data;
+ }
+ // Jellyfin 12 returns nothing for /Items/Latest without a parentId, so fall back
+ // to the most recently added movies and series.
+ const recent = await getLibraryApi(api).getItems({
+ ...request,
+ recursive: true,
+ sortBy: [ItemSortBy.DateCreated],
+ sortOrder: [SortOrder.Descending],
+ excludeLocationTypes: [LocationType.Virtual],
+ limit: 16,
});
- return media.data;
+ return recent.data.Items ?? [];
},
});
diff --git a/src/utils/store/audioPlayback.ts b/src/utils/store/audioPlayback.ts
index c2d2b19..935f088 100644
--- a/src/utils/store/audioPlayback.ts
+++ b/src/utils/store/audioPlayback.ts
@@ -93,7 +93,7 @@ export const generateAudioStreamUrl = (
const urlOptions = {
userId,
deviceId,
- api_key,
+ ApiKey: api_key,
container: directPlayContainers,
maxAudioChannels: transcodingProfile?.MaxAudioChannels,
transcodingContainer: transcodingProfile?.Container,
diff --git a/src/utils/store/playback.ts b/src/utils/store/playback.ts
index b5c6c61..96f6df1 100644
--- a/src/utils/store/playback.ts
+++ b/src/utils/store/playback.ts
@@ -788,7 +788,7 @@ export const initializePlayback = async (args: {
tag: source.ETag,
mediaSourceId: source.Id,
deviceId: api.deviceInfo.id,
- api_key: api.accessToken,
+ ApiKey: api.accessToken,
};
let playMethod: PlayMethod = PlayMethod.Transcode;
@@ -1045,7 +1045,7 @@ export const changeAudioTrack = async (trackIndex: number, api: Api) => {
tag: mediaSource.MediaSources?.[0].ETag,
mediaSourceId: mediaSource.MediaSources?.[0].Id,
deviceId: api?.deviceInfo.id,
- api_key: api?.accessToken,
+ ApiKey: api?.accessToken,
};
const urlParams = new URLSearchParams(urlOptions).toString();
let playbackUrl = `${api?.basePath}/Videos/${mediaSource.MediaSources?.[0].Id}/stream.${mediaSource.MediaSources?.[0].Container}?${urlParams}`;