mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-15 00:43:08 +01:00
fix: jellyfin 12 fixes
This commit is contained in:
@@ -221,22 +221,33 @@ const HomeMobile = () => {
|
||||
queryKey,
|
||||
queryFn: async ({ pageParam = 0 }) => {
|
||||
if (!api) return [];
|
||||
// getLatestMedia doesn't support startIndex, so we fetch all and slice client-side
|
||||
const allData =
|
||||
(
|
||||
await getUserLibraryApi(api).getLatestMedia({
|
||||
userId: user?.Id,
|
||||
limit: 10,
|
||||
fields: ["PrimaryImageAspectRatio"],
|
||||
imageTypeLimit: 1,
|
||||
enableImageTypes: ["Primary", "Backdrop", "Thumb"],
|
||||
includeItemTypes,
|
||||
parentId,
|
||||
})
|
||||
).data || [];
|
||||
|
||||
// Simulate pagination by slicing
|
||||
return allData.slice(pageParam, pageParam + pageSize);
|
||||
// Use getItems (not getLatestMedia) so we get item-level results
|
||||
// filtered by type from a specific library. getLatestMedia is
|
||||
// episode-oriented and groups results, which drops Series when
|
||||
// combined with a parentId + includeItemTypes filter.
|
||||
//
|
||||
// The specific reason for this is jellyfin 12.0 returns episodes, seasons, or shows,
|
||||
// but we only handle shows in our recently added in [shows] section. So we need to filter by type at the item level.
|
||||
//
|
||||
// For Series we sort by DateLastContentAdded so shows bubble up when
|
||||
// a new episode is added (series cards for new episodes, matching how
|
||||
// Jellyfin's "Latest" row worked pre-12.0). Movies use DateCreated.
|
||||
const response = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
parentId,
|
||||
includeItemTypes,
|
||||
recursive: true,
|
||||
sortBy: includeItemTypes.includes("Series")
|
||||
? ["DateLastContentAdded"]
|
||||
: ["DateCreated"],
|
||||
sortOrder: ["Descending"],
|
||||
startIndex: pageParam,
|
||||
limit: pageSize,
|
||||
fields: ["PrimaryImageAspectRatio"],
|
||||
imageTypeLimit: 1,
|
||||
enableImageTypes: ["Primary", "Backdrop", "Thumb"],
|
||||
});
|
||||
return response.data.Items || [];
|
||||
},
|
||||
type: "InfiniteScrollingCollectionList",
|
||||
pageSize,
|
||||
@@ -250,9 +261,7 @@ const HomeMobile = () => {
|
||||
|
||||
const latestMediaViews = collections.map((c) => {
|
||||
const includeItemTypes: BaseItemKind[] =
|
||||
c.CollectionType === "tvshows" || c.CollectionType === "movies"
|
||||
? []
|
||||
: ["Movie"];
|
||||
c.CollectionType === "tvshows" ? ["Series"] : ["Movie"];
|
||||
const title = t("home.recently_added_in", { libraryName: c.Name });
|
||||
const queryKey: string[] = [
|
||||
"home",
|
||||
|
||||
Reference in New Issue
Block a user