Finished show support

This commit is contained in:
James Hawkins 2021-07-14 18:03:10 +01:00
parent 32a8518193
commit 3bd0e7a69e
7 changed files with 26 additions and 8 deletions

View File

@ -56,7 +56,7 @@
background-color: #36363e; background-color: #36363e;
color: white; color: white;
height: auto; height: auto;
width: 5%; width: 10%;
box-sizing: border-box; box-sizing: border-box;
} }
@ -130,7 +130,8 @@
.inputOptionBox { .inputOptionBox {
margin-top: .5rem; margin-top: .5rem;
width: 50%; width: 50%;
align-items:stretch; /* align-items:stretch; */
align-self: center;
padding: .7rem 1.5rem; padding: .7rem 1.5rem;
} }
} }

View File

@ -34,7 +34,7 @@ export function InputBox({ onSubmit, placeholder }) {
type='text' type='text'
className='inputOptionBox' className='inputOptionBox'
id='inputOptionBoxSeason' id='inputOptionBoxSeason'
placeholder='season' placeholder='Season'
value={season} value={season}
onChange={(e) => setSeason(e.target.value)} onChange={(e) => setSeason(e.target.value)}
hidden={showContentType} hidden={showContentType}
@ -44,7 +44,7 @@ export function InputBox({ onSubmit, placeholder }) {
type='text' type='text'
className='inputOptionBox' className='inputOptionBox'
id='inputOptionBoxEpisode' id='inputOptionBoxEpisode'
placeholder='episode' placeholder='Episode'
value={episode} value={episode}
onChange={(e) => setEpisode(e.target.value)} onChange={(e) => setEpisode(e.target.value)}
hidden={showContentType} hidden={showContentType}

View File

@ -12,6 +12,7 @@ export function MovieRow(props) {
<span className="year">({props.year})</span> <span className="year">({props.year})</span>
</div> </div>
<div className="watch"> <div className="watch">
<span className='attribute' hidden={props.type === 'show' ? false : true }>{props.season}x{props.episode}</span>
<p>Watch {props.type}</p> <p>Watch {props.type}</p>
<Arrow/> <Arrow/>
</div> </div>

View File

@ -1,7 +1,7 @@
.title { .title {
font-size: 2rem; font-size: 2rem;
color: white; color: white;
max-width: 20rem; /* max-width: 20rem; */
margin: 0; margin: 0;
padding: 0; padding: 0;
margin-bottom: 3.5rem; margin-bottom: 3.5rem;

View File

@ -79,6 +79,10 @@ async function getStreamUrl(slug, type, season, episode) {
} }
} }
if (id === '') {
return { url: '' }
}
const videoUrl = await getVideoUrl({ const videoUrl = await getVideoUrl({
slug: slug, slug: slug,
id: id, id: id,

View File

@ -11,7 +11,7 @@ export function MovieView(props) {
<div className="cardView"> <div className="cardView">
<Card fullWidth> <Card fullWidth>
<Title accent="Return to home" accentLink="search"> <Title accent="Return to home" accentLink="search">
{ streamData.title } {streamData.title} {streamData.type === "show" ? `(${streamData.season}x${streamData.episode})` : '' }
</Title> </Title>
<VideoElement streamUrl={streamUrl}/> <VideoElement streamUrl={streamUrl}/>
</Card> </Card>

View File

@ -32,11 +32,18 @@ export function SearchView() {
setProgress(2); setProgress(2);
setText(`Getting stream for "${title}"`) setText(`Getting stream for "${title}"`)
const { url } = await getStreamUrl(slug, type, season, episode); const { url } = await getStreamUrl(slug, type, season, episode);
if (url === '') {
return fail(`Not found: ${title} (${season}x${episode})`)
}
setProgress(maxSteps); setProgress(maxSteps);
setStreamUrl(url); setStreamUrl(url);
setStreamData({ setStreamData({
title, title,
type, type,
season,
episode
}) })
setText(`Streaming...`) setText(`Streaming...`)
navigate("movie") navigate("movie")
@ -57,6 +64,11 @@ export function SearchView() {
if (options.length === 0) { if (options.length === 0) {
return fail(`Could not find that ${contentType}`) return fail(`Could not find that ${contentType}`)
} else if (options.length > 1) { } else if (options.length > 1) {
options.forEach((o) => {
o.season = season;
o.episode = episode;
});
setProgress(2); setProgress(2);
setText(`Choose your ${contentType}`); setText(`Choose your ${contentType}`);
setOptions(options); setOptions(options);
@ -86,9 +98,9 @@ export function SearchView() {
Whoops, there are a few movies like that Whoops, there are a few movies like that
</Title> </Title>
{options?.map((v, i) => ( {options?.map((v, i) => (
<MovieRow key={i} title={v.title} type={v.type} year={v.year} onClick={() => { <MovieRow key={i} title={v.title} type={v.type} year={v.year} season={v.season} episode={v.episode} onClick={() => {
setShowingOptions(false) setShowingOptions(false)
getStream(v.title, v.slug, v.type) getStream(v.title, v.slug, v.type, v.season, v.episode)
}}/> }}/>
))} ))}
</Card> </Card>