feat: remember library filters #192
This commit is contained in:
8 files changed
+267
-198
No files matched your search
@@ -1 +0,0 @@
|
|||||||
{"encodings":["src\\main.tsx","ProviderWrapper",[40,0,44,1],[41,13,41,42],[42,19,42,54],[43,8,43,71],"src\\utils\\store\\api.tsx","ApiProvider",[57,27,71,1],[57,28,57,40],[58,17,69,2],[70,8,70,75],"useApiInContext",[73,7,79,1],[74,15,74,37],[78,8,78,34],"src\\routes\\_api\\search\\index.jsx","SearchPage",[30,0,448,1],[31,13,31,36],[33,37,33,49],[34,21,34,49],[36,14,44,3],[48,16,62,3],[63,16,77,3],[78,20,92,3],[93,15,107,3],[108,14,122,3],[123,22,137,3],[138,16,150,3],[151,18,164,3],[166,23,166,71],[168,1,171,7],[173,2,446,8],[183,3,236,9],[184,4,235,6],[201,7,230,24],[202,8,229,14],[210,9,227,11],[228,9,228,65],[237,3,421,9],[243,5,262,20],[245,7,260,9],[265,5,290,20],[267,7,288,9],[293,5,307,20],[296,8,304,10],[310,5,329,20],[312,7,327,9],[332,5,352,20],[334,7,350,9],[355,5,375,20],[357,7,373,9],[378,5,397,20],[380,7,395,9],[400,5,419,20],[402,7,417,9],[438,5,444,11],[443,6,443,68],"src\\routes\\_api\\favorite\\index.tsx","FavoritePage",[20,0,304,1],[21,13,21,36],[22,23,22,71],[24,14,32,3],[34,16,45,3],[47,16,58,3],[60,20,71,3],[73,15,84,3],[86,14,97,3],[99,22,110,3],[112,16,123,3],[125,1,127,3],[130,2,302,9],[141,4,160,19],[143,6,158,8],[163,4,188,19],[165,6,186,8],[191,4,210,19],[193,6,208,8],[213,4,233,19],[215,6,231,8],[236,4,256,19],[238,6,254,8],[259,4,278,19],[261,6,276,8],[281,4,300,19],[283,6,298,8],"src\\routes\\_api\\home\\index.tsx","Home",[38,0,419,1],[39,13,39,42],[41,14,49,3],[51,19,61,3],[63,21,83,3],[85,26,99,3],[101,26,114,3],[116,21,135,3],[137,47,137,59],[139,18,139,31],[145,1,162,26],[162,5,162,24],[171,3,416,10],[178,4,205,20],[180,6,180,26],[183,7,202,9],[185,9,185,52],[207,4,241,20],[209,6,211,12],[210,7,210,51],[215,6,215,23],[217,6,239,21],[221,10,236,12],[242,4,303,20],[244,6,246,12],[245,7,245,52],[250,6,250,23],[254,6,301,21],[257,9,298,11],[304,4,362,20],[306,6,308,12],[307,7,307,59],[312,6,312,23],[317,6,360,21],[320,9,357,11],[363,4,404,20],[365,6,367,12],[366,7,366,59],[371,6,371,23],[376,6,402,21],[379,9,399,11],[405,4,415,20],[407,6,409,12],[408,7,408,62],[413,13,413,69],"src\\routes\\setup\\server.add.tsx","ServerSetup",[25,0,152,1],[26,33,26,45],[28,29,28,42],[30,18,30,60],[32,21,66,3],[70,3,79,5],[80,3,149,15],[88,4,148,11],[95,5,97,12],[96,6,96,54],[98,5,108,12],[99,6,107,8],[109,5,123,12],[110,6,122,22],[116,8,116,71],[124,5,147,12],[136,6,143,13],[144,6,146,19],"src\\routes\\_api\\player\\index.tsx","VideoPlayer",[81,0,592,1],[82,13,82,36],[83,21,83,32],[84,39,84,54],[96,5,106,3],[108,31,108,45],[109,41,109,55],[111,51,111,66],[114,31,114,46],[115,31,115,45],[116,35,116,50],[117,45,117,68],[118,33,118,56],[119,43,119,58],[120,43,120,67],[121,49,123,2],[124,29,124,40],[125,27,125,42],[127,1,127,41],[129,49,129,71],[209,16,209,28],[223,24,259,7],[261,1,269,21],[269,5,269,19],[271,1,302,38],[302,5,302,18],[302,20,302,36],[304,1,307,15],[307,5,307,13],[310,2,590,8],[311,3,334,21],[313,5,332,18],[331,6,331,52],[335,3,562,16],[352,4,400,10],[353,5,355,18],[354,6,354,66],[356,5,360,18],[359,6,359,64],[361,5,399,12],[382,6,398,18],[390,7,392,18],[394,8,396,19],[401,4,561,10],[402,5,409,18],[405,7,407,20],[410,5,560,11],[411,6,452,12],[412,7,445,9],[446,7,451,13],[447,8,449,21],[450,8,450,61],[453,6,559,12],[454,7,485,13],[455,8,455,30],[456,8,464,21],[461,9,463,16],[465,8,469,21],[466,9,468,16],[470,8,478,21],[475,9,477,16],[479,8,479,26],[480,8,484,21],[486,7,558,13],[487,8,523,21],[509,9,511,22],[512,9,522,11],[524,8,537,21],[530,9,536,16],[538,8,538,23],[539,8,545,21],[540,9,544,16],[546,8,557,21],[554,9,556,16],[564,3,589,5],"src\\routes\\_api\\login\\index.tsx","LoginRoute",[19,0,91,1],[20,18,20,31],[21,18,21,31],[22,13,22,36],[23,29,23,65],[25,19,32,3],[48,2,89,13],[48,22,48,45],[49,3,88,9],[60,4,60,48],[61,4,87,22],[62,5,86,18],[75,6,85,19],"src\\routes\\setup\\server.list.tsx","ServerList",[28,0,203,1],[29,18,29,31],[30,39,30,53],[31,29,31,42],[33,21,33,37],[35,17,38,3],[40,23,43,3],[45,28,63,3],[87,1,89,7],[92,2,201,8],[93,3,93,21],[94,3,114,9],[103,4,105,17],[106,4,113,17],[112,5,112,56],[115,3,200,11],[118,6,198,12],[119,7,121,13],[122,7,170,13],[123,8,151,21],[133,10,149,12],[135,12,141,25],[152,8,160,21],[161,8,169,21],[171,7,197,13],[172,8,183,21],[182,9,182,62],[184,8,196,21],[195,9,195,71],"src\\routes\\_api\\playlist\\$id.jsx","TabPanel",[23,0,38,1],[23,18,23,23],[27,2,36,8],[35,23,35,44],"PlaylistTitlePage",[57,0,229,1],[58,16,58,33],[59,13,59,36],[61,14,69,3],[71,14,84,3],[86,22,99,3],[101,21,112,3],[114,26,114,74],[116,1,126,7],[130,3,140,9],[139,4,139,24],[145,3,223,9],[160,7,168,9],[174,5,221,20],[181,8,218,10],[227,9,227,24],"src\\routes\\_api\\series\\$id.tsx",[65,0,80,1],[65,18,65,23],[69,2,78,8],[77,23,77,44],"SeriesTitlePage",[99,0,1205,1],[100,16,100,33],[102,13,102,36],[104,14,112,3],[114,14,127,3],[129,22,142,3],[144,17,157,3],[159,23,174,3],[176,43,179,3],[180,55,180,70],[182,43,185,3],[187,27,199,3],[201,18,216,3],[218,25,228,3],[229,26,229,74],[231,35,231,47],[232,31,232,43],[233,29,233,41],[234,35,234,47],[236,1,260,21],[260,5,260,19],[262Line truncated
|
|
||||||
@@ -104,7 +104,6 @@ const PlayButton = ({
|
|||||||
playlistId: playlistItemId,
|
playlistId: playlistItemId,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(itemType);
|
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
case BaseItemKind.Episode:
|
case BaseItemKind.Episode:
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
result = await getTvShowsApi(api).getEpisodes({
|
||||||
@@ -119,7 +118,7 @@ const PlayButton = ({
|
|||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
seasonId: item.SeasonId,
|
seasonId: item.SeasonId,
|
||||||
startItemId: item.Id,
|
// startItemId: item.Id,
|
||||||
});
|
});
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
audioStreamIndex: currentAudioTrack,
|
audioStreamIndex: currentAudioTrack,
|
||||||
@@ -297,7 +296,7 @@ const PlayButton = ({
|
|||||||
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
||||||
);
|
);
|
||||||
// URL generation
|
// URL generation
|
||||||
const urlOptions = {
|
const urlOptions: URLSearchParams = {
|
||||||
Static: true,
|
Static: true,
|
||||||
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
||||||
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const CardComponent = ({
|
|||||||
disableOverlay = false,
|
disableOverlay = false,
|
||||||
overrideIcon,
|
overrideIcon,
|
||||||
}: {
|
}: {
|
||||||
item: BaseItemDto;
|
item: BaseItemDto | null;
|
||||||
cardTitle: string | undefined | null;
|
cardTitle: string | undefined | null;
|
||||||
cardCaption?: string | null | number;
|
cardCaption?: string | null | number;
|
||||||
imageType: ImageType;
|
imageType: ImageType;
|
||||||
|
|||||||
@@ -36,13 +36,13 @@ const MusicTrack = ({
|
|||||||
trackIndex,
|
trackIndex,
|
||||||
className = "",
|
className = "",
|
||||||
}: {
|
}: {
|
||||||
item: BaseItemDto;
|
item?: BaseItemDto | null;
|
||||||
queryKey: QueryKey;
|
queryKey?: QueryKey;
|
||||||
userId: string | undefined;
|
userId?: string | undefined;
|
||||||
playlistItem: boolean;
|
playlistItem?: boolean;
|
||||||
playlistItemId: string;
|
playlistItemId?: string;
|
||||||
trackIndex: number;
|
trackIndex?: number;
|
||||||
className: string;
|
className?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import Typography from "@mui/material/Typography";
|
|||||||
import { red } from "@mui/material/colors";
|
import { red } from "@mui/material/colors";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export const ErrorNotice = ({ error }) => {
|
export const ErrorNotice = ({ error }: { error?: unknown }) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import "./textLink.scss";
|
import "./textLink.scss";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
const TextLink = ({ children, location, variant, otherProps }) => {
|
const TextLink = ({ children, location, variant, otherProps }) => {
|
||||||
// const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Typography
|
<Typography
|
||||||
variant={variant}
|
variant={variant}
|
||||||
className="link flex"
|
className="link flex"
|
||||||
// onClick={() => navigate(location)}
|
onClick={() => navigate({ to: location })}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
+250
-182
@@ -1,31 +1,23 @@
|
|||||||
import React, {
|
import React, {
|
||||||
useState,
|
useState,
|
||||||
useEffect,
|
useEffect,
|
||||||
useLayoutEffect,
|
|
||||||
type ChangeEvent,
|
type ChangeEvent,
|
||||||
useMemo,
|
useMemo,
|
||||||
useCallback,
|
useCallback,
|
||||||
type MouseEvent,
|
type MouseEvent,
|
||||||
} from "react";
|
} from "react";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import Accordion from "@mui/material/Accordion";
|
|
||||||
import AccordionDetails from "@mui/material/AccordionDetails";
|
|
||||||
import AccordionSummary from "@mui/material/AccordionSummary";
|
|
||||||
import Box from "@mui/material/Box";
|
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import Checkbox from "@mui/material/Checkbox";
|
import Checkbox from "@mui/material/Checkbox";
|
||||||
import Chip from "@mui/material/Chip";
|
import Chip from "@mui/material/Chip";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import Grow from "@mui/material/Grow";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import Popper from "@mui/material/Popper";
|
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
import { getArtistsApi } from "@jellyfin/sdk/lib/utils/api/artists-api";
|
import { getArtistsApi } from "@jellyfin/sdk/lib/utils/api/artists-api";
|
||||||
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
||||||
@@ -43,7 +35,6 @@ import MusicTrack from "@/components/musicTrack";
|
|||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import { setBackdrop } from "@/utils/store/backdrop";
|
import { setBackdrop } from "@/utils/store/backdrop";
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
|
||||||
type BaseItemDtoQueryResult,
|
type BaseItemDtoQueryResult,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
CollectionType,
|
CollectionType,
|
||||||
@@ -54,23 +45,16 @@ import {
|
|||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
import {
|
import { FormControl, Menu, Stack, useScrollTrigger } from "@mui/material";
|
||||||
FormControl,
|
|
||||||
Menu,
|
|
||||||
MenuList,
|
|
||||||
Stack,
|
|
||||||
useScrollTrigger,
|
|
||||||
} from "@mui/material";
|
|
||||||
import { useWindowVirtualizer } from "@tanstack/react-virtual";
|
import { useWindowVirtualizer } from "@tanstack/react-virtual";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import "./library.scss";
|
import "./library.scss";
|
||||||
import LibraryItemsSkeleton from "@/components/skeleton/libraryItems";
|
import LibraryItemsSkeleton from "@/components/skeleton/libraryItems";
|
||||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
type SortByObject = { title: string; value: ItemSortBy };
|
type SortByObject = { title: string; value: ItemSortBy };
|
||||||
type ViewObject = { title: string; value: BaseItemKind | "Artist" };
|
type ViewObject = { title: string; value: BaseItemKind | "Artist" };
|
||||||
// type allowedFilters = ["movies", "tvshows", "music", "books"];
|
// type allowedFilters = ["movies", "tvshows", "music", "books"];
|
||||||
type allowedFilters = Partial<CollectionType>[];
|
|
||||||
|
|
||||||
const useWindowWidth = () => {
|
const useWindowWidth = () => {
|
||||||
const [width, setWidth] = React.useState(window.innerWidth);
|
const [width, setWidth] = React.useState(window.innerWidth);
|
||||||
@@ -97,7 +81,6 @@ export const Route = createFileRoute("/_api/library/$id")({
|
|||||||
|
|
||||||
function LibraryView() {
|
function LibraryView() {
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
|
|
||||||
@@ -217,16 +200,24 @@ function LibraryView() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [sortBy, setSortBy] = useState<ItemSortBy>("Name");
|
const [sortBy, setSortBy] = useState<ItemSortBy>("Name");
|
||||||
const [sortAscending, setSortAscending] = useState(true);
|
const [sortAscending, setSortAscending] = useState(
|
||||||
|
() =>
|
||||||
|
JSON.parse(
|
||||||
|
sessionStorage.getItem(
|
||||||
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
|
) as string,
|
||||||
|
)?.sortAscending ?? true,
|
||||||
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// I don't know why this works, don't ask...
|
// I don't know why this works, don't ask...
|
||||||
const cachedVal = sessionStorage.getItem(
|
const cachedVal = sessionStorage.getItem(
|
||||||
`library-${currentLib.data?.Id}-config_sort`,
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
) as unknown as {
|
) as unknown as {
|
||||||
sortAscending: boolean;
|
sortAscending?: boolean;
|
||||||
sortBy: ItemSortBy;
|
sortBy?: ItemSortBy;
|
||||||
};
|
};
|
||||||
if (cachedVal) {
|
if (cachedVal?.sortAscending) {
|
||||||
|
console.log(cachedVal.sortAscending);
|
||||||
setSortAscending(cachedVal.sortAscending);
|
setSortAscending(cachedVal.sortAscending);
|
||||||
}
|
}
|
||||||
}, [currentLib.data?.Id]);
|
}, [currentLib.data?.Id]);
|
||||||
@@ -453,25 +444,45 @@ function LibraryView() {
|
|||||||
return result;
|
return result;
|
||||||
}, [currentLib.data?.CollectionType, currentViewType]);
|
}, [currentLib.data?.CollectionType, currentViewType]);
|
||||||
|
|
||||||
const [filters, setFilters] = useState<Record<string, undefined | boolean>>({
|
const [filters, setFilters] = useState<Record<string, undefined | boolean>>(
|
||||||
isPlayed: false,
|
() => {
|
||||||
isUnPlayed: false,
|
const cachedVal = sessionStorage.getItem(
|
||||||
isResumable: false,
|
`library-${currentLib.data?.Id}-config_fliters`,
|
||||||
isFavorite: false,
|
);
|
||||||
isLiked: false,
|
if (
|
||||||
isUnliked: false,
|
cachedVal !== null
|
||||||
hasSubtitles: false,
|
) {
|
||||||
hasTrailer: false,
|
return JSON.parse(
|
||||||
hasSpecialFeature: false,
|
cachedVal
|
||||||
hasThemeSong: false,
|
);
|
||||||
hasThemeVideo: false,
|
}
|
||||||
isBluRay: false,
|
return {
|
||||||
isDVD: false,
|
isPlayed: false,
|
||||||
isHD: undefined,
|
isUnPlayed: false,
|
||||||
isSD: false,
|
isResumable: false,
|
||||||
is4K: false,
|
isFavorite: false,
|
||||||
is3D: false,
|
isLiked: false,
|
||||||
});
|
isUnliked: false,
|
||||||
|
hasSubtitles: false,
|
||||||
|
hasTrailer: false,
|
||||||
|
hasSpecialFeature: false,
|
||||||
|
hasThemeSong: false,
|
||||||
|
hasThemeVideo: false,
|
||||||
|
isBluRay: false,
|
||||||
|
isDVD: false,
|
||||||
|
isHD: undefined,
|
||||||
|
isSD: false,
|
||||||
|
is4K: false,
|
||||||
|
is3D: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
useEffect(() => {
|
||||||
|
sessionStorage.setItem(
|
||||||
|
`library-${currentLib.data?.Id}-config_fliters`,
|
||||||
|
JSON.stringify(filters),
|
||||||
|
);
|
||||||
|
}, [filters, currentLib.data?.Id]);
|
||||||
|
|
||||||
const items = useQuery({
|
const items = useQuery({
|
||||||
queryKey: [
|
queryKey: [
|
||||||
@@ -684,12 +695,14 @@ function LibraryView() {
|
|||||||
const temp = items.data.Items?.filter(
|
const temp = items.data.Items?.filter(
|
||||||
(item) => item.BackdropImageTags?.length,
|
(item) => item.BackdropImageTags?.length,
|
||||||
);
|
);
|
||||||
setBackdrop(
|
if (temp?.[0]?.Id) {
|
||||||
api.getItemImageUrl(temp?.[0]?.Id, "Backdrop", {
|
setBackdrop(
|
||||||
tag: temp?.[0]?.BackdropImageTags?.[0],
|
api.getItemImageUrl(temp?.[0]?.Id, "Backdrop", {
|
||||||
}),
|
tag: temp?.[0]?.BackdropImageTags?.[0],
|
||||||
temp?.[0]?.BackdropImageTags?.[0] ?? "none",
|
}),
|
||||||
);
|
temp?.[0]?.BackdropImageTags?.[0] ?? "none",
|
||||||
|
);
|
||||||
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
}, [items]);
|
}, [items]);
|
||||||
@@ -792,7 +805,16 @@ function LibraryView() {
|
|||||||
{!disableSort && (
|
{!disableSort && (
|
||||||
<div className="flex flex-row flex-center">
|
<div className="flex flex-row flex-center">
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => setSortAscending((state) => !state)}
|
onClick={() => {
|
||||||
|
sessionStorage.setItem(
|
||||||
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
|
JSON.stringify({
|
||||||
|
sortAscending: !sortAscending,
|
||||||
|
sortBy,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
setSortAscending((state: boolean) => !state);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
@@ -810,7 +832,7 @@ function LibraryView() {
|
|||||||
value={sortBy ?? "Name"}
|
value={sortBy ?? "Name"}
|
||||||
size="small"
|
size="small"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setSortBy(e.target.value);
|
setSortBy(e.target.value as ItemSortBy);
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`library-${currentLib.data?.Id}-config_sort`,
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@@ -834,7 +856,7 @@ function LibraryView() {
|
|||||||
value={currentViewType}
|
value={currentViewType}
|
||||||
size="small"
|
size="small"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setCurrentViewType(e.target.value);
|
setCurrentViewType(e.target.value as BaseItemKind);
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`library-${currentLib.data?.Id}-config_currentViewType`,
|
`library-${currentLib.data?.Id}-config_currentViewType`,
|
||||||
e.target.value,
|
e.target.value,
|
||||||
@@ -892,44 +914,60 @@ function LibraryView() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isPlayed} />}
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={filters.isPlayed}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setFilters((s) => ({
|
||||||
|
...s,
|
||||||
|
isPlayed: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
label="Played"
|
label="Played"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setFilters((s) => ({
|
|
||||||
...s,
|
|
||||||
isPlayed: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isUnPlayed} />}
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={filters.isUnPlayed}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setFilters((s) => ({
|
||||||
|
...s,
|
||||||
|
isUnPlayed: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
label="Unplayed"
|
label="Unplayed"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setFilters((s) => ({
|
|
||||||
...s,
|
|
||||||
isUnPlayed: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isResumable} />}
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={filters.isResumable}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setFilters((s) => ({
|
||||||
|
...s,
|
||||||
|
isResumable: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
label="Resumable"
|
label="Resumable"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setFilters((s) => ({
|
|
||||||
...s,
|
|
||||||
isResumable: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isFavorite} />}
|
control={
|
||||||
label="Favorites"
|
<Checkbox
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
checked={filters.isFavorite}
|
||||||
setFilters((s) => ({
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
...s,
|
setFilters((s) => ({
|
||||||
isFavorite: e.target.checked,
|
...s,
|
||||||
}))
|
isFavorite: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
|
label="Favorites"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -949,56 +987,74 @@ function LibraryView() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.hasSubtitles} />}
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={filters.hasSubtitles}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setFilters((s) => ({
|
||||||
|
...s,
|
||||||
|
hasSubtitles: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
label="Subtitles"
|
label="Subtitles"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setFilters((s) => ({
|
|
||||||
...s,
|
|
||||||
hasSubtitles: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<FormControlLabel
|
|
||||||
control={<Checkbox checked={filters.hasTrailer} />}
|
|
||||||
label="Trailer"
|
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setFilters((s) => ({
|
|
||||||
...s,
|
|
||||||
hasTrailer: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Checkbox checked={filters.hasSpecialFeature} />
|
<Checkbox
|
||||||
|
checked={filters.hasTrailer}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setFilters((s) => ({
|
||||||
|
...s,
|
||||||
|
hasTrailer: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label="Trailer"
|
||||||
|
/>
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={filters.hasSpecialFeature}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setFilters((s) => ({
|
||||||
|
...s,
|
||||||
|
hasSpecialFeature: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
label="Special Features"
|
label="Special Features"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setFilters((s) => ({
|
|
||||||
...s,
|
|
||||||
hasSpecialFeature: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.hasThemeSong} />}
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={filters.hasThemeSong}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setFilters((s) => ({
|
||||||
|
...s,
|
||||||
|
hasThemeSong: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
label="Theme Song"
|
label="Theme Song"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setFilters((s) => ({
|
|
||||||
...s,
|
|
||||||
hasThemeSong: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.hasThemeVideo} />}
|
control={
|
||||||
label="Theme Video"
|
<Checkbox
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
checked={filters.hasThemeVideo}
|
||||||
setFilters((s) => ({
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
...s,
|
setFilters((s) => ({
|
||||||
hasThemeVideo: e.target.checked,
|
...s,
|
||||||
}))
|
hasThemeVideo: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
|
label="Theme Video"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -1019,45 +1075,59 @@ function LibraryView() {
|
|||||||
>
|
>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Checkbox checked={videoTypesState.BluRay} />
|
<Checkbox
|
||||||
|
checked={videoTypesState.BluRay}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setVideoTypesState((s) => ({
|
||||||
|
...s,
|
||||||
|
BluRay: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
label="BluRay"
|
label="BluRay"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setVideoTypesState((s) => ({
|
|
||||||
...s,
|
|
||||||
BluRay: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={videoTypesState.Dvd} />}
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={videoTypesState.Dvd}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
setVideoTypesState((s) => ({
|
||||||
|
...s,
|
||||||
|
Dvd: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
label="DVD"
|
label="DVD"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
|
||||||
setVideoTypesState((s) => ({
|
|
||||||
...s,
|
|
||||||
Dvd: e.target.checked,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isHD} />}
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={filters.isHD}
|
||||||
|
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
setFilters((s) => ({
|
||||||
|
...s,
|
||||||
|
isHD: e.target.checked,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
label="HD"
|
label="HD"
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
||||||
setFilters((s) => ({
|
|
||||||
...s,
|
|
||||||
isHD: e.target.checked,
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.is4K} />}
|
control={
|
||||||
label="4k"
|
<Checkbox
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
checked={filters.is4K}
|
||||||
setFilters((s) => ({
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
...s,
|
setFilters((s) => ({
|
||||||
is4K: e.target.checked,
|
...s,
|
||||||
}))
|
is4K: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
|
label="4k"
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={false} />}
|
control={<Checkbox checked={false} />}
|
||||||
@@ -1065,14 +1135,18 @@ function LibraryView() {
|
|||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox value={filters.is3D} />}
|
control={
|
||||||
label="3D"
|
<Checkbox
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
value={filters.is3D}
|
||||||
setFilters((s) => ({
|
onChange={(e) =>
|
||||||
...s,
|
setFilters((s) => ({
|
||||||
is3D: e.target.checked,
|
...s,
|
||||||
}))
|
is3D: e.target.checked,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
|
label="3D"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Menu>
|
</Menu>
|
||||||
@@ -1116,10 +1190,10 @@ function LibraryView() {
|
|||||||
const fromIndex = index * itemsPerRow;
|
const fromIndex = index * itemsPerRow;
|
||||||
const toIndex = Math.min(
|
const toIndex = Math.min(
|
||||||
fromIndex + itemsPerRow,
|
fromIndex + itemsPerRow,
|
||||||
items.data?.TotalRecordCount,
|
items.data?.TotalRecordCount ?? 0,
|
||||||
);
|
);
|
||||||
for (let i = fromIndex; i < toIndex; i++) {
|
for (let i = fromIndex; i < toIndex; i++) {
|
||||||
const item = items.data?.Items[i];
|
const item = items.data?.Items?.[i];
|
||||||
displayItems.push(
|
displayItems.push(
|
||||||
<div
|
<div
|
||||||
className="library-virtual-item"
|
className="library-virtual-item"
|
||||||
@@ -1128,18 +1202,18 @@ function LibraryView() {
|
|||||||
ref={virtualizer.measureElement}
|
ref={virtualizer.measureElement}
|
||||||
>
|
>
|
||||||
<Card
|
<Card
|
||||||
item={item}
|
item={item ?? null}
|
||||||
seriesId={item.SeriesId}
|
seriesId={item?.SeriesId}
|
||||||
cardTitle={
|
cardTitle={
|
||||||
item.Type === BaseItemKind.Episode
|
item?.Type === BaseItemKind.Episode
|
||||||
? item.SeriesName
|
? item.SeriesName
|
||||||
: item.Name
|
: item?.Name
|
||||||
}
|
}
|
||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
cardCaption={
|
cardCaption={
|
||||||
item.Type === BaseItemKind.Episode
|
item?.Type === BaseItemKind.Episode
|
||||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||||
: item.Type === BaseItemKind.Series
|
: item?.Type === BaseItemKind.Series
|
||||||
? `${item.ProductionYear} - ${
|
? `${item.ProductionYear} - ${
|
||||||
item.EndDate
|
item.EndDate
|
||||||
? new Date(item.EndDate).toLocaleString(
|
? new Date(item.EndDate).toLocaleString(
|
||||||
@@ -1150,32 +1224,26 @@ function LibraryView() {
|
|||||||
)
|
)
|
||||||
: "Present"
|
: "Present"
|
||||||
}`
|
}`
|
||||||
: item.ProductionYear
|
: item?.ProductionYear
|
||||||
}
|
}
|
||||||
disableOverlay={
|
disableOverlay={
|
||||||
item.Type === BaseItemKind.Person ||
|
item?.Type === BaseItemKind.Person ||
|
||||||
item.Type === BaseItemKind.Genre ||
|
item?.Type === BaseItemKind.Genre ||
|
||||||
item.Type === BaseItemKind.MusicGenre ||
|
item?.Type === BaseItemKind.MusicGenre ||
|
||||||
item.Type === BaseItemKind.Studio
|
item?.Type === BaseItemKind.Studio
|
||||||
}
|
}
|
||||||
cardType={
|
cardType={
|
||||||
item.Type === BaseItemKind.MusicAlbum ||
|
item?.Type === BaseItemKind.MusicAlbum ||
|
||||||
item.Type === BaseItemKind.Audio ||
|
item?.Type === BaseItemKind.Audio ||
|
||||||
item.Type === BaseItemKind.Genre ||
|
item?.Type === BaseItemKind.Genre ||
|
||||||
item.Type === BaseItemKind.MusicGenre ||
|
item?.Type === BaseItemKind.MusicGenre ||
|
||||||
item.Type === BaseItemKind.Studio ||
|
item?.Type === BaseItemKind.Studio ||
|
||||||
item.Type === BaseItemKind.Playlist
|
item?.Type === BaseItemKind.Playlist
|
||||||
? "square"
|
? "square"
|
||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
// queryKey={items}
|
// queryKey={items}
|
||||||
userId={user.data.Id}
|
userId={user.data?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>,
|
</div>,
|
||||||
);
|
);
|
||||||
@@ -1210,7 +1278,7 @@ function LibraryView() {
|
|||||||
const item = items.data?.Items?.[virtualRow.index];
|
const item = items.data?.Items?.[virtualRow.index];
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={item.Id}
|
key={item?.Id}
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: 0,
|
top: 0,
|
||||||
@@ -1221,7 +1289,7 @@ function LibraryView() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MusicTrack
|
<MusicTrack
|
||||||
item={item}
|
item={item ?? null}
|
||||||
// queryKey={[
|
// queryKey={[
|
||||||
// "libraryView",
|
// "libraryView",
|
||||||
// "currentLibItems",
|
// "currentLibItems",
|
||||||
@@ -1260,7 +1328,7 @@ function LibraryView() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (currentLib.isError) {
|
if (currentLib.isError) {
|
||||||
return <h6>{currentLib.error}</h6>;
|
return <ErrorNotice error={currentLib.error} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import useQueue from "@/utils/store/queue";
|
|||||||
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
||||||
import { toNumber } from "lodash";
|
import { toNumber } from "lodash";
|
||||||
import type { OnProgressProps } from "react-player/base";
|
import type { OnProgressProps } from "react-player/base";
|
||||||
|
import type { TrackProps } from "react-player/file";
|
||||||
|
|
||||||
const ticksDisplay = (ticks: number) => {
|
const ticksDisplay = (ticks: number) => {
|
||||||
const time = Math.round(ticks / 10000);
|
const time = Math.round(ticks / 10000);
|
||||||
@@ -283,7 +284,7 @@ function VideoPlayer() {
|
|||||||
setIsReady(false);
|
setIsReady(false);
|
||||||
}, [item?.Id]);
|
}, [item?.Id]);
|
||||||
|
|
||||||
const reactPlayerCaptions = useMemo(() => {
|
const reactPlayerCaptions: TrackProps = useMemo(() => {
|
||||||
if (
|
if (
|
||||||
(mediaSource.subtitle.format === "vtt" ||
|
(mediaSource.subtitle.format === "vtt" ||
|
||||||
mediaSource.subtitle.format === "subrip") &&
|
mediaSource.subtitle.format === "subrip") &&
|
||||||
@@ -303,6 +304,7 @@ function VideoPlayer() {
|
|||||||
}, [mediaSource.subtitle.track, mediaSource.subtitle.enable]);
|
}, [mediaSource.subtitle.track, mediaSource.subtitle.enable]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log(mediaSource.subtitle);
|
||||||
if (player.current?.getInternalPlayer() && mediaSource.subtitle.enable) {
|
if (player.current?.getInternalPlayer() && mediaSource.subtitle.enable) {
|
||||||
if (
|
if (
|
||||||
mediaSource.subtitle.format === "ass" ||
|
mediaSource.subtitle.format === "ass" ||
|
||||||
|
|||||||
Reference in new issue
Block a user