From 3bd0e7a69e239e766fd0c62bf4f17eeec10baaff Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 14 Jul 2021 18:03:10 +0100 Subject: [PATCH] Finished show support --- src/components/InputBox.css | 5 +++-- src/components/InputBox.js | 4 ++-- src/components/MovieRow.js | 1 + src/components/Title.css | 2 +- src/lib/lookMovie.js | 4 ++++ src/views/Movie.js | 2 +- src/views/Search.js | 16 ++++++++++++++-- 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/components/InputBox.css b/src/components/InputBox.css index f7d2b16d..f1480b9c 100644 --- a/src/components/InputBox.css +++ b/src/components/InputBox.css @@ -56,7 +56,7 @@ background-color: #36363e; color: white; height: auto; - width: 5%; + width: 10%; box-sizing: border-box; } @@ -130,7 +130,8 @@ .inputOptionBox { margin-top: .5rem; width: 50%; - align-items:stretch; + /* align-items:stretch; */ + align-self: center; padding: .7rem 1.5rem; } } diff --git a/src/components/InputBox.js b/src/components/InputBox.js index a392733c..a42900b9 100644 --- a/src/components/InputBox.js +++ b/src/components/InputBox.js @@ -34,7 +34,7 @@ export function InputBox({ onSubmit, placeholder }) { type='text' className='inputOptionBox' id='inputOptionBoxSeason' - placeholder='season' + placeholder='Season' value={season} onChange={(e) => setSeason(e.target.value)} hidden={showContentType} @@ -44,7 +44,7 @@ export function InputBox({ onSubmit, placeholder }) { type='text' className='inputOptionBox' id='inputOptionBoxEpisode' - placeholder='episode' + placeholder='Episode' value={episode} onChange={(e) => setEpisode(e.target.value)} hidden={showContentType} diff --git a/src/components/MovieRow.js b/src/components/MovieRow.js index a3ae80bd..c304aa4d 100644 --- a/src/components/MovieRow.js +++ b/src/components/MovieRow.js @@ -12,6 +12,7 @@ export function MovieRow(props) { ({props.year})
+

Watch {props.type}

diff --git a/src/components/Title.css b/src/components/Title.css index bd1790ed..6796dce9 100644 --- a/src/components/Title.css +++ b/src/components/Title.css @@ -1,7 +1,7 @@ .title { font-size: 2rem; color: white; - max-width: 20rem; + /* max-width: 20rem; */ margin: 0; padding: 0; margin-bottom: 3.5rem; diff --git a/src/lib/lookMovie.js b/src/lib/lookMovie.js index 9c3014f1..b6d19178 100644 --- a/src/lib/lookMovie.js +++ b/src/lib/lookMovie.js @@ -79,6 +79,10 @@ async function getStreamUrl(slug, type, season, episode) { } } + if (id === '') { + return { url: '' } + } + const videoUrl = await getVideoUrl({ slug: slug, id: id, diff --git a/src/views/Movie.js b/src/views/Movie.js index d0f9a83e..a1b3438d 100644 --- a/src/views/Movie.js +++ b/src/views/Movie.js @@ -11,7 +11,7 @@ export function MovieView(props) {
- { streamData.title } + {streamData.title} {streamData.type === "show" ? `(${streamData.season}x${streamData.episode})` : '' } diff --git a/src/views/Search.js b/src/views/Search.js index f6ef4912..d40866e1 100644 --- a/src/views/Search.js +++ b/src/views/Search.js @@ -32,11 +32,18 @@ export function SearchView() { setProgress(2); setText(`Getting stream for "${title}"`) const { url } = await getStreamUrl(slug, type, season, episode); + + if (url === '') { + return fail(`Not found: ${title} (${season}x${episode})`) + } + setProgress(maxSteps); setStreamUrl(url); setStreamData({ title, type, + season, + episode }) setText(`Streaming...`) navigate("movie") @@ -57,6 +64,11 @@ export function SearchView() { if (options.length === 0) { return fail(`Could not find that ${contentType}`) } else if (options.length > 1) { + options.forEach((o) => { + o.season = season; + o.episode = episode; + }); + setProgress(2); setText(`Choose your ${contentType}`); setOptions(options); @@ -86,9 +98,9 @@ export function SearchView() { Whoops, there are a few movies like that {options?.map((v, i) => ( - { + { setShowingOptions(false) - getStream(v.title, v.slug, v.type) + getStream(v.title, v.slug, v.type, v.season, v.episode) }}/> ))}