mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-24 18:51:53 +01:00
it actually continues watching now!
This commit is contained in:
parent
b3cd011bfa
commit
2dd3a3f82a
@ -88,6 +88,30 @@ export function MovieView(props) {
|
||||
}
|
||||
}, [streamData, selectedSeason])
|
||||
|
||||
React.useEffect(() => {
|
||||
let cancel = false;
|
||||
|
||||
if (!cancel) {
|
||||
let ls = JSON.parse(localStorage.getItem("video-progress") || "{}")
|
||||
let key = streamData.type === "show" ? `${season}-${episode}` : "full"
|
||||
let time = ls?.[streamData.source]?.[streamData.type]?.[streamData.slug]?.[key]?.currentlyAt;
|
||||
|
||||
if (time) {
|
||||
const element = document.getElementsByClassName('videoElement')[0];
|
||||
|
||||
if (!element) {
|
||||
return () => { cancel = false }
|
||||
}
|
||||
|
||||
element.currentTime = time;
|
||||
}
|
||||
}
|
||||
|
||||
return () => {
|
||||
cancel = true;
|
||||
}
|
||||
})
|
||||
|
||||
const setProgress = (evt) => {
|
||||
let ls = JSON.parse(localStorage.getItem("video-progress") || "{}")
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
import React from 'react';
|
||||
import { Redirect, useRouteMatch, useHistory } from 'react-router-dom';
|
||||
import { Helmet } from 'react-helmet';
|
||||
import { InputBox } from '../components/InputBox';
|
||||
import { Title } from '../components/Title';
|
||||
import { Redirect, useHistory, useRouteMatch } from 'react-router-dom';
|
||||
import { Arrow } from '../components/Arrow';
|
||||
import { Card } from '../components/Card';
|
||||
import { ErrorBanner } from '../components/ErrorBanner';
|
||||
import { InputBox } from '../components/InputBox';
|
||||
import { MovieRow } from '../components/MovieRow';
|
||||
import { Arrow } from '../components/Arrow';
|
||||
import { Progress } from '../components/Progress';
|
||||
import { findContent, getStreamUrl, getEpisodes } from '../lib/index';
|
||||
import { useMovie } from '../hooks/useMovie';
|
||||
import { Title } from '../components/Title';
|
||||
import { TypeSelector } from '../components/TypeSelector';
|
||||
import { useMovie } from '../hooks/useMovie';
|
||||
import { findContent, getEpisodes, getStreamUrl } from '../lib/index';
|
||||
|
||||
import './Search.css';
|
||||
|
||||
@ -161,7 +161,7 @@ export function SearchView() {
|
||||
|
||||
setContinueWatching(newContinueWatching)
|
||||
})
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (!type || (type !== 'movie' && type !== 'show')) {
|
||||
return <Redirect to="/movie" />
|
||||
@ -229,7 +229,14 @@ export function SearchView() {
|
||||
{/* Continue watching */}
|
||||
{continueWatching.length > 0 && page === 'watching' ? <Card>
|
||||
<Title>Continue watching</Title>
|
||||
{continueWatching?.map((v, i) => (
|
||||
{Object.entries(continueWatching.reduce((a, v) => {
|
||||
if (!a[v.source]) a[v.source] = []
|
||||
a[v.source].push(v)
|
||||
return a;
|
||||
}, {})).map(v => (
|
||||
<div key={v[0]}>
|
||||
<p className="source">{v[0]}</p>
|
||||
{v[1].map((v, i) => (
|
||||
<MovieRow key={i} title={v.data.meta.title} slug={v.data.meta.slug} type={v.type} year={v.data.meta.year} source={v.source} place={v.data.show} percentage={v.percentageDone} onClick={() => {
|
||||
if (v.type === 'show') {
|
||||
history.push(`${routeMatch.url}/${v.source}/${v.data.meta.title}/${v.slug}/season/${v.data.show.season}/episode/${v.data.show.episode}`)
|
||||
@ -241,6 +248,8 @@ export function SearchView() {
|
||||
getStream(v.data.meta.title, v.data.meta.slug, v.type, v.source, v.data.meta.year)
|
||||
}} />
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</Card> : <React.Fragment></React.Fragment>}
|
||||
|
||||
<div className="topRightCredits">
|
||||
|
Loading…
Reference in New Issue
Block a user