Add video quality filters #176

This commit is contained in:
Prayag Prajapati committed 2023-09-26 18:40:01 +05:30
1 parent 747f502387
commit 38884e25d8
2 files changed
+230 -47

No files matched your search

+227 -46
View File
@@ -123,38 +123,6 @@ const LibraryView = () => {
const [isFavorite, setisFavorite] = useState(false); const [isFavorite, setisFavorite] = useState(false);
const [isLiked, setIsLiked] = useState(false); const [isLiked, setIsLiked] = useState(false);
const [isUnliked, setIsUnliked] = useState(false); const [isUnliked, setIsUnliked] = useState(false);
const availableWatchStatus = [
{
title: "Played",
value: false,
state: (val) => setIsPlayed(val),
},
{
title: "Unplayed",
value: false,
state: (val) => setIsUnPlayed(val),
},
{
title: "Resumable",
value: false,
state: (val) => setIsResumable(val),
},
{
title: "Favourite",
value: false,
state: (val) => setisFavorite(val),
},
{
title: "Liked",
value: false,
state: (val) => setIsLiked(val),
},
{
title: "UnLiked",
value: false,
state: (val) => setIsUnliked(val),
},
];
const [hasSubtitles, setHasSubtitles] = useState(false); const [hasSubtitles, setHasSubtitles] = useState(false);
const [hasTrailer, setHasTrailer] = useState(false); const [hasTrailer, setHasTrailer] = useState(false);
@@ -308,6 +276,8 @@ const LibraryView = () => {
const [filterArray, setFilterArray] = useState([]); const [filterArray, setFilterArray] = useState([]);
const [videoTypes, setVideoTypes] = useState([]);
const fetchLibItems = async (libraryId) => { const fetchLibItems = async (libraryId) => {
let result; let result;
if (currentViewType == "MusicArtist") { if (currentViewType == "MusicArtist") {
@@ -371,7 +341,7 @@ const LibraryView = () => {
hasSpecialFeature: hasSpecialFeature ? true : undefined, hasSpecialFeature: hasSpecialFeature ? true : undefined,
hasThemeSong: hasThemeSong ? true : undefined, hasThemeSong: hasThemeSong ? true : undefined,
hasThemeVideo: hasThemeVideo ? true : undefined, hasThemeVideo: hasThemeVideo ? true : undefined,
videoTypes: [isBluRay && "BluRay", isDVD && "Dvd"], videoTypes: videoTypes,
isHd: isHD ? true : undefined, isHd: isHD ? true : undefined,
is4K: is4K ? true : undefined, is4K: is4K ? true : undefined,
is3D: is3D ? true : undefined, is3D: is3D ? true : undefined,
@@ -401,7 +371,7 @@ const LibraryView = () => {
hasThemeSong: hasThemeSong, hasThemeSong: hasThemeSong,
hasThemeVideo: hasThemeVideo, hasThemeVideo: hasThemeVideo,
}, },
qualityFIlters: { qualityFilters: {
isBluRay: isBluRay, isBluRay: isBluRay,
isDVD: isDVD, isDVD: isDVD,
isHD: isHD, isHD: isHD,
@@ -451,14 +421,6 @@ const LibraryView = () => {
items.refetch(); items.refetch();
}; };
const disablePaginationViews = [
"MusicArtist",
"Person",
"Genre",
"MusicGenre",
"Studio",
];
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]); const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
useState(() => { useState(() => {
@@ -949,6 +911,227 @@ const LibraryView = () => {
/> />
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
{currentLib.data.Items[0]
.CollectionType ==
"movies" && (
<Accordion className="library-filter-accordian">
<AccordionSummary
expandIcon={
<MdiChevronDown />
}
>
<Typography variant="subtitle1">
Quality
</Typography>
</AccordionSummary>
<AccordionDetails
style={{
background:
"rgb(0 0 0 / 0.4)",
padding: "0 !important",
}}
>
<FormControlLabel
className="library-filter"
label="BluRay"
control={
<Checkbox
value={
isBluRay
}
onChange={(
e,
) => {
setIsBluRay(
e
.target
.checked,
);
if (
e
.target
.checked
) {
setVideoTypes(
(
state,
) => [
...state,
"BluRay",
],
);
} else {
setVideoTypes(
filterArray.filter(
(
val,
) =>
val !=
"BluRay",
),
);
}
}}
/>
}
labelPlacement="start"
componentsProps={{
typography:
{
style: {
justifySelf:
"start",
},
},
}}
/>
<FormControlLabel
className="library-filter"
label="Dvd"
control={
<Checkbox
value={
isDVD
}
onChange={(
e,
) => {
setIsDVD(
e
.target
.checked,
);
if (
e
.target
.checked
) {
setVideoTypes(
(
state,
) => [
...state,
"Dvd",
],
);
} else {
setVideoTypes(
filterArray.filter(
(
val,
) =>
val !=
"Dvd",
),
);
}
}}
/>
}
labelPlacement="start"
componentsProps={{
typography:
{
style: {
justifySelf:
"start",
},
},
}}
/>
<FormControlLabel
className="library-filter"
label="Hd"
control={
<Checkbox
value={
isHD
}
onChange={(
e,
) => {
setIsHD(
e
.target
.checked,
);
}}
/>
}
labelPlacement="start"
componentsProps={{
typography:
{
style: {
justifySelf:
"start",
},
},
}}
/>
<FormControlLabel
className="library-filter"
label="4k"
control={
<Checkbox
value={
is4K
}
onChange={(
e,
) => {
setIs4K(
e
.target
.checked,
);
}}
/>
}
labelPlacement="start"
componentsProps={{
typography:
{
style: {
justifySelf:
"start",
},
},
}}
/>
<FormControlLabel
className="library-filter"
label="3D"
control={
<Checkbox
value={
is3D
}
onChange={(
e,
) => {
setIs3D(
e
.target
.checked,
);
}}
/>
}
labelPlacement="start"
componentsProps={{
typography:
{
style: {
justifySelf:
"start",
},
},
}}
/>
</AccordionDetails>
</Accordion>
)}
</div> </div>
</Grow> </Grow>
)} )}
@@ -1100,7 +1283,7 @@ const LibraryView = () => {
hasThemeVideo: hasThemeVideo:
hasThemeVideo, hasThemeVideo,
}, },
qualityFIlters: { qualityFilters: {
isBluRay: isBluRay:
isBluRay, isBluRay,
isDVD: isDVD, isDVD: isDVD,
@@ -1252,9 +1435,7 @@ const LibraryView = () => {
</TableContainer> </TableContainer>
)} )}
{!items.isLoading && {items.isSuccess &&
!disablePaginationViews.includes(currentViewType) &&
items.isSuccess &&
items.data.TotalRecordCount > maxDisplayItems && ( items.data.TotalRecordCount > maxDisplayItems && (
<Stack <Stack
alignItems="center" alignItems="center"
+3 -1
View File
@@ -83,6 +83,7 @@
background: rgb(0 0 0 / 0.65); background: rgb(0 0 0 / 0.65);
border-radius: $border-radius-default; border-radius: $border-radius-default;
box-shadow: 0 0 10px rgb(0 0 0 / 0.4); box-shadow: 0 0 10px rgb(0 0 0 / 0.4);
backdrop-filter: blur(10px);
} }
width: 100%; width: 100%;
@@ -94,7 +95,8 @@
} }
&-accordian { &-accordian {
background: transparent !important; background: transparent !important;
backdrop-filter: blur(10px); margin: 0 !important;
box-shadow: none !important;
} }
} }
&-genre { &-genre {