mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
fix: Recently Added isn't updating correctly. (#686)
This commit is contained in:
@@ -367,7 +367,15 @@ const Page = () => {
|
|||||||
className='mr-1'
|
className='mr-1'
|
||||||
id={libraryId}
|
id={libraryId}
|
||||||
queryKey='sortBy'
|
queryKey='sortBy'
|
||||||
queryFn={async () => sortOptions.map((s) => s.key)}
|
queryFn={async () =>
|
||||||
|
sortOptions
|
||||||
|
.filter(
|
||||||
|
(s) =>
|
||||||
|
library?.CollectionType !== "movies" ||
|
||||||
|
s.key !== SortByOption.DateLastContentAdded,
|
||||||
|
)
|
||||||
|
.map((s) => s.key)
|
||||||
|
}
|
||||||
set={setSortBy}
|
set={setSortBy}
|
||||||
values={sortBy}
|
values={sortBy}
|
||||||
title={t("library.filters.sort_by")}
|
title={t("library.filters.sort_by")}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ const SeriesPoster: React.FC<MoviePosterProps> = ({ item }) => {
|
|||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{<WatchedIndicator item={item} />}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -206,19 +206,43 @@ export const HomeIndex = () => {
|
|||||||
queryKey,
|
queryKey,
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!api) return [];
|
if (!api) return [];
|
||||||
return (
|
|
||||||
(
|
const response = await getItemsApi(api).getItems({
|
||||||
await getUserLibraryApi(api).getLatestMedia({
|
userId: user?.Id,
|
||||||
userId: user?.Id,
|
limit: 40,
|
||||||
limit: 20,
|
recursive: true,
|
||||||
fields: ["PrimaryImageAspectRatio", "Path"],
|
includeItemTypes,
|
||||||
imageTypeLimit: 1,
|
sortBy: ["DateCreated"],
|
||||||
enableImageTypes: ["Primary", "Backdrop", "Thumb"],
|
sortOrder: ["Descending"],
|
||||||
includeItemTypes,
|
fields: ["PrimaryImageAspectRatio", "Path"],
|
||||||
parentId,
|
parentId,
|
||||||
})
|
enableImageTypes: ["Primary", "Backdrop", "Thumb"],
|
||||||
).data || []
|
});
|
||||||
);
|
|
||||||
|
let items = response.data.Items || [];
|
||||||
|
|
||||||
|
if (includeItemTypes.includes("Episode")) {
|
||||||
|
// Removes individual episodes from the list if they are part of a series
|
||||||
|
// and only keeps the series item
|
||||||
|
// Note: The 'Latest' API endpoint does not work well with combining batch episode imports
|
||||||
|
// and will either only show the series or the episodes, not both.
|
||||||
|
// This is a workaround to filter out the episodes from the list
|
||||||
|
const seriesIds = new Set(
|
||||||
|
items.filter((i) => i.Type === "Series").map((i) => i.Id),
|
||||||
|
);
|
||||||
|
|
||||||
|
items = items.filter(
|
||||||
|
(i) =>
|
||||||
|
i.Type === "Series" ||
|
||||||
|
(i.Type === "Episode" && !seriesIds.has(i.SeriesId!)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items.length > 20) {
|
||||||
|
items = items.slice(0, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
},
|
},
|
||||||
type: "ScrollingCollectionList",
|
type: "ScrollingCollectionList",
|
||||||
}),
|
}),
|
||||||
@@ -232,7 +256,7 @@ export const HomeIndex = () => {
|
|||||||
|
|
||||||
const latestMediaViews = collections.map((c) => {
|
const latestMediaViews = collections.map((c) => {
|
||||||
const includeItemTypes: BaseItemKind[] =
|
const includeItemTypes: BaseItemKind[] =
|
||||||
c.CollectionType === "tvshows" ? ["Series"] : ["Movie"];
|
c.CollectionType === "tvshows" ? ["Episode", "Series"] : ["Movie"];
|
||||||
const title = t("home.recently_added_in", { libraryName: c.Name });
|
const title = t("home.recently_added_in", { libraryName: c.Name });
|
||||||
const queryKey = [
|
const queryKey = [
|
||||||
"home",
|
"home",
|
||||||
@@ -358,10 +382,10 @@ export const HomeIndex = () => {
|
|||||||
const response = await getTvShowsApi(api).getNextUp({
|
const response = await getTvShowsApi(api).getNextUp({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
fields: ["MediaSourceCount"],
|
fields: ["MediaSourceCount"],
|
||||||
limit: section.items?.limit || 25,
|
limit: section.nextUp?.limit || 25,
|
||||||
enableImageTypes: ["Primary", "Backdrop", "Thumb"],
|
enableImageTypes: ["Primary", "Backdrop", "Thumb"],
|
||||||
enableResumable: section.items?.enableResumable,
|
enableResumable: section.nextUp?.enableResumable,
|
||||||
enableRewatching: section.items?.enableRewatching,
|
enableRewatching: section.nextUp?.enableRewatching,
|
||||||
});
|
});
|
||||||
return response.data.Items || [];
|
return response.data.Items || [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export enum SortByOption {
|
|||||||
CommunityRating = "CommunityRating",
|
CommunityRating = "CommunityRating",
|
||||||
CriticRating = "CriticRating",
|
CriticRating = "CriticRating",
|
||||||
DateCreated = "DateCreated",
|
DateCreated = "DateCreated",
|
||||||
|
DateLastContentAdded = "DateLastContentAdded",
|
||||||
DatePlayed = "DatePlayed",
|
DatePlayed = "DatePlayed",
|
||||||
PlayCount = "PlayCount",
|
PlayCount = "PlayCount",
|
||||||
ProductionYear = "ProductionYear",
|
ProductionYear = "ProductionYear",
|
||||||
@@ -37,6 +38,7 @@ export const sortOptions: {
|
|||||||
{ key: SortByOption.CommunityRating, value: "Community Rating" },
|
{ key: SortByOption.CommunityRating, value: "Community Rating" },
|
||||||
{ key: SortByOption.CriticRating, value: "Critics Rating" },
|
{ key: SortByOption.CriticRating, value: "Critics Rating" },
|
||||||
{ key: SortByOption.DateCreated, value: "Date Added" },
|
{ key: SortByOption.DateCreated, value: "Date Added" },
|
||||||
|
{ key: SortByOption.DateLastContentAdded, value: "Date Episode Added" },
|
||||||
{ key: SortByOption.DatePlayed, value: "Date Played" },
|
{ key: SortByOption.DatePlayed, value: "Date Played" },
|
||||||
{ key: SortByOption.PlayCount, value: "Play Count" },
|
{ key: SortByOption.PlayCount, value: "Play Count" },
|
||||||
{ key: SortByOption.ProductionYear, value: "Production Year" },
|
{ key: SortByOption.ProductionYear, value: "Production Year" },
|
||||||
|
|||||||
Reference in New Issue
Block a user