refactor: start using seach params in library route
This commit is contained in:
7 files changed
+922
-1260
No files matched your search
@@ -72,6 +72,7 @@
|
||||
"typescript": "^5.8.3",
|
||||
"vite-plugin-svgr": "^4.3.0",
|
||||
"wavesurfer.js": "^7.9.9",
|
||||
"zod": "^4.0.5",
|
||||
"zustand": "5.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Generated
+8
@@ -185,6 +185,9 @@ importers:
|
||||
wavesurfer.js:
|
||||
specifier: ^7.9.9
|
||||
version: 7.9.9
|
||||
zod:
|
||||
specifier: ^4.0.5
|
||||
version: 4.0.5
|
||||
zustand:
|
||||
specifier: 5.0.6
|
||||
version: 5.0.6(@types/react@19.1.8)(immer@10.1.1)(react@19.1.0)(use-sync-external-store@1.5.0(react@19.1.0))
|
||||
@@ -3051,6 +3054,9 @@ packages:
|
||||
zod@3.25.67:
|
||||
resolution: {integrity: sha512-idA2YXwpCdqUSKRCACDE6ItZD9TZzy3OZMtpfLoh6oPR47lipysRrJfjzMqFxQ3uJuUPyUeWe1r9vLH33xO/Qw==}
|
||||
|
||||
zod@4.0.5:
|
||||
resolution: {integrity: sha512-/5UuuRPStvHXu7RS+gmvRf4NXrNxpSllGwDnCBcJZtQsKrviYXm54yDGV2KYNLT5kq0lHGcl7lqWJLgSaG+tgA==}
|
||||
|
||||
zustand@5.0.6:
|
||||
resolution: {integrity: sha512-ihAqNeUVhe0MAD+X8M5UzqyZ9k3FFZLBTtqo6JLPwV53cbRB/mJwBI0PxcIgqhBBHlEs8G45OTDTMq3gNcLq3A==}
|
||||
engines: {node: '>=12.20.0'}
|
||||
@@ -6036,6 +6042,8 @@ snapshots:
|
||||
|
||||
zod@3.25.67: {}
|
||||
|
||||
zod@4.0.5: {}
|
||||
|
||||
zustand@5.0.6(@types/react@19.1.8)(immer@10.1.1)(react@19.1.0)(use-sync-external-store@1.5.0(react@19.1.0)):
|
||||
optionalDependencies:
|
||||
'@types/react': 19.1.8
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
import {
|
||||
type BaseItemDtoQueryResult,
|
||||
BaseItemKind,
|
||||
ItemFilter,
|
||||
type ItemSortBy,
|
||||
SortOrder,
|
||||
VideoType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getArtistsApi } from "@jellyfin/sdk/lib/utils/api/artists-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||
import { getStudiosApi } from "@jellyfin/sdk/lib/utils/api/studios-api";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { getRouteApi } from "@tanstack/react-router";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { getLibraryQueryOptions } from "@/utils/queries/library";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { Card } from "../card/card";
|
||||
|
||||
const libraryRoute = getRouteApi("/_api/library/$id");
|
||||
|
||||
const LibraryItemsGrid = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const {
|
||||
currentViewType,
|
||||
sortAscending = true,
|
||||
sortBy = "SortName",
|
||||
filters = {},
|
||||
videoTypesState = {},
|
||||
} = libraryRoute.useSearch();
|
||||
const currentLibraryId = libraryRoute.useParams().id;
|
||||
const currentLibrary = useSuspenseQuery(
|
||||
getLibraryQueryOptions(api, user?.Id, currentLibraryId),
|
||||
);
|
||||
const items = useSuspenseQuery({
|
||||
queryKey: [
|
||||
"library",
|
||||
"items",
|
||||
currentLibraryId,
|
||||
{
|
||||
currentViewType: currentViewType,
|
||||
sortAscending: sortAscending,
|
||||
sortBy: sortBy,
|
||||
filters,
|
||||
videoTypesState,
|
||||
// genreFilter,
|
||||
},
|
||||
],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
let result: AxiosResponse<BaseItemDtoQueryResult, any>;
|
||||
if (currentViewType === "MusicArtist") {
|
||||
result = await getArtistsApi(api).getAlbumArtists({
|
||||
userId: user?.Id,
|
||||
parentId: currentLibraryId,
|
||||
});
|
||||
} else if (currentViewType === "Artist") {
|
||||
result = await getArtistsApi(api).getArtists({
|
||||
userId: user?.Id,
|
||||
parentId: currentLibraryId,
|
||||
});
|
||||
} else if (currentViewType === "Person") {
|
||||
result = await getPersonsApi(api).getPersons({
|
||||
userId: user?.Id,
|
||||
personTypes: ["Actor"],
|
||||
});
|
||||
} else if (currentViewType === "Studio") {
|
||||
result = await getStudiosApi(api).getStudios({
|
||||
userId: user?.Id,
|
||||
parentId: currentLibraryId,
|
||||
});
|
||||
} else if (currentViewType === "BoxSet") {
|
||||
const videoTypes: VideoType[] = [];
|
||||
if (videoTypesState.BluRay) videoTypes.push(VideoType.BluRay);
|
||||
if (videoTypesState.Dvd) videoTypes.push(VideoType.Dvd);
|
||||
if (videoTypesState.Iso) videoTypes.push(VideoType.Iso);
|
||||
if (videoTypesState.VideoFile) videoTypes.push(VideoType.VideoFile);
|
||||
|
||||
const filtersArray: ItemFilter[] = [];
|
||||
if (filters.isPlayed) filtersArray.push(ItemFilter.IsPlayed);
|
||||
if (filters.isUnPlayed) filtersArray.push(ItemFilter.IsUnplayed);
|
||||
if (filters.isResumable) filtersArray.push(ItemFilter.IsResumable);
|
||||
if (filters.isFavorite) filtersArray.push(ItemFilter.IsFavorite);
|
||||
|
||||
result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
parentId: currentLibraryId,
|
||||
recursive:
|
||||
currentLibrary.data.CollectionType === "boxsets" ? undefined : true,
|
||||
// includeItemTypes: [currentViewType],
|
||||
sortOrder: [
|
||||
sortAscending ? SortOrder.Ascending : SortOrder.Descending,
|
||||
],
|
||||
sortBy: sortBy.split(",") as ItemSortBy[],
|
||||
filters: filtersArray,
|
||||
hasSubtitles: filters.hasSubtitles ? true : undefined,
|
||||
hasTrailer: filters.hasTrailer ? true : undefined,
|
||||
hasSpecialFeature: filters.hasSpecialFeature ? true : undefined,
|
||||
hasThemeSong: filters.hasThemeSong ? true : undefined,
|
||||
hasThemeVideo: filters.hasThemeVideo ? true : undefined,
|
||||
videoTypes: videoTypes,
|
||||
isHd: filters.isSD ? true : filters.isHD || undefined,
|
||||
is4K: filters.is4K || undefined,
|
||||
is3D: filters.is3D || undefined,
|
||||
enableUserData: true,
|
||||
// genreIds: genreFilter,
|
||||
});
|
||||
} else {
|
||||
const videoTypes: VideoType[] = [];
|
||||
if (videoTypesState.BluRay) videoTypes.push(VideoType.BluRay);
|
||||
if (videoTypesState.Dvd) videoTypes.push(VideoType.Dvd);
|
||||
if (videoTypesState.Iso) videoTypes.push(VideoType.Iso);
|
||||
if (videoTypesState.VideoFile) videoTypes.push(VideoType.VideoFile);
|
||||
|
||||
const filtersArray: ItemFilter[] = [];
|
||||
if (filters.isPlayed) filtersArray.push(ItemFilter.IsPlayed);
|
||||
if (filters.isUnPlayed) filtersArray.push(ItemFilter.IsUnplayed);
|
||||
if (filters.isResumable) filtersArray.push(ItemFilter.IsResumable);
|
||||
if (filters.isFavorite) filtersArray.push(ItemFilter.IsFavorite);
|
||||
if (!currentViewType) {
|
||||
throw new Error("currentViewType is required");
|
||||
}
|
||||
result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
parentId: currentLibraryId,
|
||||
recursive: true,
|
||||
includeItemTypes: [currentViewType],
|
||||
sortOrder: [
|
||||
sortAscending ? SortOrder.Ascending : SortOrder.Descending,
|
||||
],
|
||||
sortBy: sortBy.split(",") as ItemSortBy[],
|
||||
filters: filtersArray,
|
||||
hasSubtitles: filters.hasSubtitles ? true : undefined,
|
||||
hasTrailer: filters.hasTrailer ? true : undefined,
|
||||
hasSpecialFeature: filters.hasSpecialFeature ? true : undefined,
|
||||
hasThemeSong: filters.hasThemeSong ? true : undefined,
|
||||
hasThemeVideo: filters.hasThemeVideo ? true : undefined,
|
||||
videoTypes: videoTypes,
|
||||
isHd: filters.isSD ? true : filters.isHD || undefined,
|
||||
is4K: filters.is4K || undefined,
|
||||
is3D: filters.is3D || undefined,
|
||||
enableUserData: true,
|
||||
// genreIds: genreFilter,
|
||||
});
|
||||
}
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
// --- Backdrop ---
|
||||
const setBackdrop = useBackdropStore(useShallow((s) => s.setBackdrop));
|
||||
const [currentBackdropIndex, setCurrentBackdropIndex] = useState(1);
|
||||
const backdropItems = useMemo(() => {
|
||||
if (items.isSuccess) {
|
||||
const temp = items.data?.Items?.filter(
|
||||
(item) => Object.keys(item.ImageBlurHashes?.Backdrop ?? {}).length > 0,
|
||||
);
|
||||
const backdropItem = temp?.[0];
|
||||
|
||||
const currentBackdropItemHash =
|
||||
backdropItem?.ImageBlurHashes?.Backdrop?.[
|
||||
Object.keys(backdropItem?.ImageBlurHashes?.Backdrop ?? {})[0]
|
||||
];
|
||||
setBackdrop(currentBackdropItemHash);
|
||||
|
||||
return temp;
|
||||
}
|
||||
}, [items]);
|
||||
useEffect(() => {
|
||||
if (backdropItems?.length === 0 || !api || !backdropItems) {
|
||||
return; // No backdrop items available
|
||||
}
|
||||
const intervalId = setInterval(() => {
|
||||
const currentBackdropItemHash =
|
||||
backdropItems[currentBackdropIndex].ImageBlurHashes?.Backdrop?.[
|
||||
Object.keys(
|
||||
backdropItems[currentBackdropIndex].ImageBlurHashes?.Backdrop ?? {},
|
||||
)[0]
|
||||
];
|
||||
if (!currentBackdropItemHash) return; // No backdrop image available
|
||||
setBackdrop(currentBackdropItemHash);
|
||||
setCurrentBackdropIndex(
|
||||
(prevIndex) => (prevIndex + 1) % backdropItems.length,
|
||||
);
|
||||
}, 10_000); // Update backdrop every 10s
|
||||
return () => clearInterval(intervalId);
|
||||
}, [backdropItems]);
|
||||
return (
|
||||
<div className="library-items-container">
|
||||
{items.data?.Items?.map((item) => (
|
||||
<Card
|
||||
item={item}
|
||||
key={item?.Id}
|
||||
seriesId={item?.SeriesId}
|
||||
cardTitle={
|
||||
item?.Type === BaseItemKind.Episode ? item.SeriesName : item?.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
item?.Type === BaseItemKind.Episode
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||
: item?.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: item?.ProductionYear
|
||||
}
|
||||
disableOverlay={
|
||||
item?.Type === BaseItemKind.Person ||
|
||||
item?.Type === BaseItemKind.Genre ||
|
||||
item?.Type === BaseItemKind.MusicGenre ||
|
||||
item?.Type === BaseItemKind.Studio
|
||||
}
|
||||
cardType={
|
||||
item?.Type === BaseItemKind.MusicAlbum ||
|
||||
item?.Type === BaseItemKind.Audio ||
|
||||
item?.Type === BaseItemKind.Genre ||
|
||||
item?.Type === BaseItemKind.MusicGenre ||
|
||||
item?.Type === BaseItemKind.Studio ||
|
||||
item?.Type === BaseItemKind.Playlist
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
// queryKey={items}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default LibraryItemsGrid;
|
||||
@@ -0,0 +1,126 @@
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useScrollTrigger } from "@mui/material";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { getRouteApi, useNavigate } from "@tanstack/react-router";
|
||||
import React, { type ChangeEvent, useMemo } from "react";
|
||||
import {
|
||||
AVAILABLE_VIEWS,
|
||||
type FILTERS,
|
||||
SORT_BY_OPTIONS,
|
||||
} from "@/utils/constants/library";
|
||||
import { getLibraryQueryOptions } from "@/utils/queries/library";
|
||||
|
||||
const route = getRouteApi("/_api/library/$id");
|
||||
|
||||
const LibraryMenu = () => {
|
||||
const { currentViewType, sortAscending, filters, sortBy } = route.useSearch();
|
||||
const { id: currentLibraryId } = route.useParams();
|
||||
const { api, user } = route.useRouteContext();
|
||||
const currentLibrary = useSuspenseQuery(
|
||||
getLibraryQueryOptions(api, user?.Id, currentLibraryId),
|
||||
);
|
||||
const scrollTrigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 20,
|
||||
});
|
||||
const navigate = useNavigate();
|
||||
const _handleSortAsecendingToggle = () => {
|
||||
navigate({
|
||||
search: {
|
||||
sortAscending: !sortAscending,
|
||||
sortBy,
|
||||
},
|
||||
to: "/library/$id",
|
||||
params: {
|
||||
id: currentLibraryId ?? "",
|
||||
},
|
||||
});
|
||||
};
|
||||
const _handleChangeSortBy = () => {
|
||||
navigate({
|
||||
search: {
|
||||
sortBy,
|
||||
},
|
||||
to: "/library/$id",
|
||||
params: {
|
||||
id: currentLibraryId ?? "",
|
||||
},
|
||||
});
|
||||
};
|
||||
const _handleChangeCurrentViewType = (viewType: BaseItemKind) => {
|
||||
navigate({
|
||||
search: {
|
||||
currentViewType: viewType,
|
||||
},
|
||||
to: "/library/$id",
|
||||
params: {
|
||||
id: currentLibraryId ?? "",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const [filterButtonAnchorEl, setFilterButtonAnchorEl] =
|
||||
React.useState<null | HTMLElement>(null);
|
||||
const _filterMenuOpen = useMemo(
|
||||
() => Boolean(filterButtonAnchorEl),
|
||||
[filterButtonAnchorEl],
|
||||
);
|
||||
const _handleFilterDropdown = (event: React.MouseEvent<HTMLElement>) => {
|
||||
setFilterButtonAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
const _handleFilterChange = (key: FILTERS, value: boolean) => {
|
||||
// Update filter state and navigate
|
||||
navigate({
|
||||
search: {
|
||||
filters: { ...filters, [key]: value },
|
||||
},
|
||||
to: "/library/$id",
|
||||
params: {
|
||||
id: currentLibraryId ?? "",
|
||||
},
|
||||
});
|
||||
// Close the filter menu
|
||||
setFilterButtonAnchorEl(null);
|
||||
};
|
||||
|
||||
const _disableSortOption = useMemo(() => {
|
||||
return (
|
||||
!currentViewType ||
|
||||
!SORT_BY_OPTIONS.some(
|
||||
(option) =>
|
||||
option.compatibleViewTypes?.includes(currentViewType as any) ||
|
||||
option.compatibleCollectionTypes?.includes(
|
||||
currentLibrary.data.CollectionType as any,
|
||||
),
|
||||
)
|
||||
);
|
||||
}, [currentViewType, currentLibrary.data.CollectionType]);
|
||||
const _disableFilters = useMemo(() => {
|
||||
switch (currentViewType) {
|
||||
case BaseItemKind.Movie:
|
||||
case BaseItemKind.Audio:
|
||||
case BaseItemKind.Series:
|
||||
case BaseItemKind.BoxSet:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}, [currentViewType]);
|
||||
|
||||
if (!filters) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
scrollTrigger
|
||||
? "library-items-header glass scrolling"
|
||||
: "library-items-header"
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default LibraryMenu;
|
||||
@@ -22,6 +22,7 @@ import type { Api, Jellyfin } from "@jellyfin/sdk";
|
||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import type { QueryClient } from "@tanstack/react-query";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
||||
// import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
||||
import { DndProvider } from "react-dnd";
|
||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||
@@ -59,7 +60,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<AudioPlayer />
|
||||
<Outlet />
|
||||
<ReactQueryDevtools />
|
||||
{/* <TanStackRouterDevtools /> */}
|
||||
<TanStackRouterDevtools />
|
||||
</SnackbarProvider>
|
||||
</ThemeProvider>
|
||||
</DndProvider>
|
||||
|
||||
+287
-1259
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,258 @@
|
||||
import {
|
||||
BaseItemKind,
|
||||
CollectionType,
|
||||
ItemSortBy,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
export const AVAILABLE_VIEWS: Array<{
|
||||
title: string;
|
||||
value: BaseItemKind | "Artist";
|
||||
compatibleCollectionTypes: CollectionType[];
|
||||
}> = [
|
||||
{
|
||||
title: "Movies",
|
||||
value: BaseItemKind.Movie,
|
||||
compatibleCollectionTypes: [CollectionType.Movies],
|
||||
},
|
||||
{
|
||||
title: "Trailers",
|
||||
value: BaseItemKind.Trailer,
|
||||
compatibleCollectionTypes: [CollectionType.Movies],
|
||||
},
|
||||
{
|
||||
title: "Collections",
|
||||
value: BaseItemKind.CollectionFolder,
|
||||
compatibleCollectionTypes: [CollectionType.Movies, CollectionType.Boxsets],
|
||||
},
|
||||
{
|
||||
title: "Genres",
|
||||
compatibleCollectionTypes: [
|
||||
CollectionType.Movies,
|
||||
CollectionType.Tvshows,
|
||||
CollectionType.Music,
|
||||
],
|
||||
value: BaseItemKind.Genre,
|
||||
},
|
||||
{
|
||||
title: "Shows",
|
||||
value: BaseItemKind.Series,
|
||||
compatibleCollectionTypes: [CollectionType.Tvshows],
|
||||
},
|
||||
{
|
||||
title: "TV Networks",
|
||||
value: BaseItemKind.Studio,
|
||||
compatibleCollectionTypes: [CollectionType.Tvshows],
|
||||
},
|
||||
{
|
||||
title: "Albums",
|
||||
value: BaseItemKind.MusicAlbum,
|
||||
compatibleCollectionTypes: [CollectionType.Music],
|
||||
},
|
||||
{
|
||||
title: "Album Artist",
|
||||
value: BaseItemKind.MusicArtist,
|
||||
compatibleCollectionTypes: [CollectionType.Music],
|
||||
},
|
||||
{
|
||||
title: "Artist",
|
||||
value: "Artist",
|
||||
compatibleCollectionTypes: [CollectionType.Music],
|
||||
},
|
||||
{
|
||||
title: "Playlist",
|
||||
value: BaseItemKind.Playlist,
|
||||
compatibleCollectionTypes: [CollectionType.Music, CollectionType.Playlists],
|
||||
},
|
||||
{
|
||||
title: "Songs",
|
||||
value: BaseItemKind.Audio,
|
||||
compatibleCollectionTypes: [CollectionType.Music],
|
||||
},
|
||||
{
|
||||
title: "Books",
|
||||
value: BaseItemKind.Book,
|
||||
compatibleCollectionTypes: [CollectionType.Books],
|
||||
},
|
||||
];
|
||||
|
||||
export const SORT_BY_OPTIONS: Array<{
|
||||
title: string;
|
||||
value: ItemSortBy | ItemSortBy[];
|
||||
compatibleCollectionTypes?: CollectionType[];
|
||||
compatibleViewTypes?: BaseItemKind[];
|
||||
}> = [
|
||||
{
|
||||
title: "Name",
|
||||
value: ItemSortBy.SortName,
|
||||
compatibleCollectionTypes: [
|
||||
CollectionType.Movies,
|
||||
CollectionType.Tvshows,
|
||||
CollectionType.Boxsets,
|
||||
CollectionType.Books,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Track Name",
|
||||
value: ItemSortBy.Name,
|
||||
compatibleViewTypes: [
|
||||
BaseItemKind.Audio,
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Playlist,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Album",
|
||||
value: ItemSortBy.Album,
|
||||
compatibleViewTypes: [BaseItemKind.Audio],
|
||||
},
|
||||
{
|
||||
title: "Album Artist",
|
||||
value: ItemSortBy.AlbumArtist,
|
||||
compatibleViewTypes: [BaseItemKind.Audio, BaseItemKind.MusicAlbum],
|
||||
},
|
||||
{
|
||||
title: "Artist",
|
||||
value: ItemSortBy.Artist,
|
||||
compatibleViewTypes: [BaseItemKind.Audio],
|
||||
},
|
||||
{
|
||||
title: "Date Added",
|
||||
value: ItemSortBy.DateCreated,
|
||||
compatibleViewTypes: [
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Audio,
|
||||
BaseItemKind.Playlist,
|
||||
],
|
||||
compatibleCollectionTypes: [
|
||||
CollectionType.Movies,
|
||||
CollectionType.Boxsets,
|
||||
CollectionType.Tvshows,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Date Played",
|
||||
value: ItemSortBy.DatePlayed,
|
||||
compatibleViewTypes: [BaseItemKind.Audio, BaseItemKind.Playlist],
|
||||
compatibleCollectionTypes: [
|
||||
CollectionType.Movies,
|
||||
CollectionType.Tvshows,
|
||||
CollectionType.Boxsets,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Play Count",
|
||||
value: ItemSortBy.PlayCount,
|
||||
compatibleViewTypes: [BaseItemKind.Audio, BaseItemKind.Playlist],
|
||||
compatibleCollectionTypes: [CollectionType.Movies, CollectionType.Boxsets],
|
||||
},
|
||||
{
|
||||
title: "Release Date",
|
||||
value: ItemSortBy.PremiereDate,
|
||||
compatibleViewTypes: [
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Audio,
|
||||
BaseItemKind.Playlist,
|
||||
],
|
||||
compatibleCollectionTypes: [
|
||||
CollectionType.Movies,
|
||||
CollectionType.Tvshows,
|
||||
CollectionType.Boxsets,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Runtime",
|
||||
value: ItemSortBy.Runtime,
|
||||
compatibleViewTypes: [
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Audio,
|
||||
BaseItemKind.Playlist,
|
||||
],
|
||||
compatibleCollectionTypes: [CollectionType.Movies, CollectionType.Boxsets],
|
||||
},
|
||||
{
|
||||
title: "Random",
|
||||
value: ItemSortBy.Random,
|
||||
compatibleViewTypes: [
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Audio,
|
||||
BaseItemKind.Playlist,
|
||||
],
|
||||
compatibleCollectionTypes: [
|
||||
CollectionType.Movies,
|
||||
CollectionType.Tvshows,
|
||||
CollectionType.Boxsets,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Community Rating",
|
||||
value: ItemSortBy.CommunityRating,
|
||||
compatibleViewTypes: [
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Audio,
|
||||
BaseItemKind.Playlist,
|
||||
],
|
||||
compatibleCollectionTypes: [
|
||||
CollectionType.Movies,
|
||||
CollectionType.Tvshows,
|
||||
CollectionType.Boxsets,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Critics Rating",
|
||||
value: ItemSortBy.CriticRating,
|
||||
compatibleViewTypes: [
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Audio,
|
||||
BaseItemKind.Playlist,
|
||||
],
|
||||
compatibleCollectionTypes: [CollectionType.Movies, CollectionType.Boxsets],
|
||||
},
|
||||
{
|
||||
title: "Folder",
|
||||
value: [ItemSortBy.IsFolder, ItemSortBy.SortName],
|
||||
compatibleViewTypes: [BaseItemKind.Playlist],
|
||||
},
|
||||
{
|
||||
title: "Parental Rating",
|
||||
value: ItemSortBy.OfficialRating,
|
||||
compatibleViewTypes: [BaseItemKind.Playlist],
|
||||
compatibleCollectionTypes: [
|
||||
CollectionType.Movies,
|
||||
CollectionType.Tvshows,
|
||||
CollectionType.Boxsets,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Release Date",
|
||||
value: [
|
||||
ItemSortBy.ProductionYear,
|
||||
ItemSortBy.PremiereDate,
|
||||
ItemSortBy.SortName,
|
||||
],
|
||||
compatibleViewTypes: [
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Audio,
|
||||
BaseItemKind.Playlist,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Date Episode Added",
|
||||
value: ItemSortBy.DateLastContentAdded,
|
||||
compatibleCollectionTypes: [CollectionType.Tvshows],
|
||||
},
|
||||
];
|
||||
|
||||
export type FILTERS =
|
||||
| "isPlayed"
|
||||
| "isUnPlayed"
|
||||
| "isResumable"
|
||||
| "isFavorite"
|
||||
| "hasSubtitles"
|
||||
| "hasTrailer"
|
||||
| "hasSpecialFeature"
|
||||
| "hasThemeSong"
|
||||
| "hasThemeVideo"
|
||||
| "isSD"
|
||||
| "isHD"
|
||||
| "is4K"
|
||||
| "is3D";
|
||||
Reference in new issue
Block a user