diff --git a/src/components/EpisodeSelector.js b/src/components/EpisodeSelector.js index 9ba35b2a..f0fb16fe 100644 --- a/src/components/EpisodeSelector.js +++ b/src/components/EpisodeSelector.js @@ -3,14 +3,15 @@ import { TypeSelector } from './TypeSelector'; import { NumberSelector } from './NumberSelector'; import './EpisodeSelector.css' -export function EpisodeSelector({ setSelectedSeason, setEpisode, seasons, selectedSeason, season, episodes, currentSeason, currentEpisode, streamData }) { +export function EpisodeSelector({ setSelectedSeason, selectedSeason, setEpisode, seasons, episodes, currentSeason, currentEpisode, streamData }) { const choices = episodes ? episodes.map(v => { let progressData = JSON.parse(localStorage.getItem('video-progress') || "{}") let currentlyAt = 0; let totalDuration = 0; - const progress = progressData?.[streamData.source]?.[streamData.show]?.[streamData.slug]?.[`${season}-${v}`] + const progress = progressData?.[streamData.source]?.[streamData.type]?.[streamData.slug]?.[`${selectedSeason}-${v}`] + if (progress) { currentlyAt = progress.currentlyAt totalDuration = progress.totalDuration diff --git a/src/components/MovieRow.js b/src/components/MovieRow.js index d15d35ef..f857f5fb 100644 --- a/src/components/MovieRow.js +++ b/src/components/MovieRow.js @@ -6,13 +6,14 @@ import { PercentageOverlay } from './PercentageOverlay' // title: string // onClick: () => void export function MovieRow(props) { - const progressData = JSON.parse(localStorage.getItem("video-progress") || "{}") let progress; let percentage = null; - if(props.type === "movie") { + + if (props.type === "movie") { progress = progressData?.[props.source]?.movie?.[props.slug]?.full - if(progress) { + + if (progress) { percentage = Math.floor((progress.currentlyAt / progress.totalDuration) * 100) } } @@ -20,13 +21,15 @@ export function MovieRow(props) { return (
props.onClick && props.onClick()}>
- {props.title} {props.place ? ` — Season ${props.place.season}: episode ${props.place.episode}` : ''}  + {props.title}{props.place ? ` - S${props.place.season}:E${props.place.episode}` : ''}  ({props.year})
+

Watch {props.type}

+
) diff --git a/src/views/Movie.js b/src/views/Movie.js index ee82e4fe..2e8d4ed2 100644 --- a/src/views/Movie.js +++ b/src/views/Movie.js @@ -1,4 +1,4 @@ -import React, { useCallback } from 'react' +import React from 'react' import { useRouteMatch, useHistory } from 'react-router-dom' import { Helmet } from 'react-helmet'; import { Title } from '../components/Title' diff --git a/src/views/Search.js b/src/views/Search.js index 715534d0..9bc96e5c 100644 --- a/src/views/Search.js +++ b/src/views/Search.js @@ -56,7 +56,6 @@ export function SearchView() { let realUrl = ''; if (type === "movie") { - // getStreamUrl(slug, type, source, season, episode) const { url } = await getStreamUrl(slug, type, source); if (url === '') { @@ -65,6 +64,8 @@ export function SearchView() { realUrl = url; } + console.log(year) + setProgress(maxSteps); setStreamUrl(realUrl); setStreamData({ @@ -227,12 +228,16 @@ export function SearchView() { {/* Continue watching */} {continueWatching.length > 0 && page === 'watching' ? Continue watching - {console.log(continueWatching)} {continueWatching?.map((v, i) => ( { - history.push(`${routeMatch.url}/${v.source}/${v.data.meta.title}/${v.slug}`) + 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}`) + } else { + history.push(`${routeMatch.url}/${v.source}/${v.data.meta.title}/${v.slug}`) + } + setShowingOptions(false) - getStream(v.data.meta.title, v.data.meta.slug, v.type, v.source, v.year) + getStream(v.data.meta.title, v.data.meta.slug, v.type, v.source, v.data.meta.year) }} /> ))} : }