small changes

This commit is contained in:
James Hawkins 2021-08-06 18:13:56 +01:00
parent 7a85f05c47
commit a870b91ff3

View File

@ -64,8 +64,6 @@ export function SearchView() {
realUrl = url; realUrl = url;
} }
console.log(year)
setProgress(maxSteps); setProgress(maxSteps);
setStreamUrl(realUrl); setStreamUrl(realUrl);
setStreamData({ setStreamData({
@ -135,11 +133,13 @@ export function SearchView() {
React.useEffect(() => { React.useEffect(() => {
const progressData = JSON.parse(localStorage.getItem('video-progress') || "{}") const progressData = JSON.parse(localStorage.getItem('video-progress') || "{}")
let newContinueWatching = [] let newContinueWatching = []
Object.keys(progressData).forEach(source => {
Object.keys(progressData).forEach((source) => {
const all = [ const all = [
...Object.entries(progressData[source]?.show ?? {}), ...Object.entries(progressData[source]?.show ?? {}),
...Object.entries(progressData[source]?.movie ?? {}) ...Object.entries(progressData[source]?.movie ?? {})
] ];
for (const [slug, data] of all) { for (const [slug, data] of all) {
for (let subselection of Object.values(data)) { for (let subselection of Object.values(data)) {
let entry = { let entry = {
@ -149,17 +149,20 @@ export function SearchView() {
percentageDone: Math.floor((subselection.currentlyAt / subselection.totalDuration) * 100), percentageDone: Math.floor((subselection.currentlyAt / subselection.totalDuration) * 100),
source source
} }
if (entry.percentageDone < 90) { if (entry.percentageDone < 90) {
newContinueWatching.push(entry) newContinueWatching.push(entry)
} }
} }
} }
newContinueWatching = newContinueWatching.sort((a, b) => { newContinueWatching = newContinueWatching.sort((a, b) => {
return b.data.updatedAt - a.data.updatedAt return b.data.updatedAt - a.data.updatedAt
}) });
setContinueWatching(newContinueWatching) setContinueWatching(newContinueWatching)
}) })
}, []); });
if (!type || (type !== 'movie' && type !== 'show')) { if (!type || (type !== 'movie' && type !== 'show')) {
return <Redirect to="/movie" /> return <Redirect to="/movie" />
@ -168,7 +171,7 @@ export function SearchView() {
return ( return (
<div className="cardView"> <div className="cardView">
<Helmet> <Helmet>
<title>{type === 'movie' ? 'Movies' : 'TV Shows'} | movie-web</title> <title>{type === 'movie' ? 'movies' : 'shows'} | movie-web</title>
</Helmet> </Helmet>
{/* Nav */} {/* Nav */}