episode list

This commit is contained in:
ThaUnknown 2022-03-13 21:52:31 +01:00
parent f2397cc974
commit cedb1f65ef
4 changed files with 57 additions and 31 deletions

View file

@ -76,10 +76,10 @@
entries.push({
title: item.querySelector('title')?.textContent || '?',
link: item.querySelector('link')?.textContent || '?',
seeders: item.querySelector('seeders')?.textContent || '?',
leechers: item.querySelector('leechers')?.textContent || '?',
downloads: item.querySelector('downloads')?.textContent || '?',
size: item.querySelector('downloads')?.size || '?'
seeders: item.querySelector('seeders')?.textContent ?? '?',
leechers: item.querySelector('leechers')?.textContent ?? '?',
downloads: item.querySelector('downloads')?.textContent ?? '?',
size: item.querySelector('size')?.size ?? '?'
})
}
entries.sort((a, b) => b.seeders - a.seeders)
@ -117,7 +117,7 @@
<button class="close pointer" type="button" on:click={close}>
<span>&times;</span>
</button>
<table class="table">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">#</th>
@ -129,7 +129,7 @@
<th scope="col">Play</th>
</tr>
</thead>
<tbody class="results">
<tbody class="results pointer">
{#each table as row, index}
<tr on:click={() => play(row.link)}>
<th>{index + 1}</th>
@ -138,7 +138,7 @@
<td>{row.seeders}</td>
<td>{row.leechers}</td>
<td>{row.downloads}</td>
<td class="pointer">Play</td>
<td class="material-icons font-size-20">play_arrow</td>
</tr>
{/each}
</tbody>

View file

@ -4,8 +4,8 @@
let view = getContext('view')
let rss = getContext('rss')
function playAnime() {
$rss = { media: $view, episode: 1 }
function playAnime(episode = 1) {
$rss = { media: $view, episode }
$view = null
}
function close() {
@ -110,9 +110,12 @@
</div>
<div class="col-md-4 d-flex justify-content-end flex-column">
<div class="d-flex flex-column flex-wrap">
<button class="btn btn-primary d-flex align-items-center font-weight-bold font-size-24 h-50 mb-5" type="button" on:click={playAnime}>
<button
class="btn btn-primary d-flex align-items-center font-weight-bold font-size-24 h-50 mb-5"
type="button"
on:click={() => playAnime($view.mediaListEntry?.progress + 1)}>
<span class="material-icons mr-10 font-size-24 w-30"> play_arrow </span>
<span>{$view.progress ? 'Continue' : 'Play'}</span>
<span>{$view.mediaListEntry?.progress ? 'Continue' : 'Play'}</span>
</button>
<button class="btn d-flex align-items-center mb-5 font-weight-bold font-size-16">
<span class="material-icons mr-10 font-size-18 w-30"> live_tv </span>
@ -132,7 +135,26 @@
<div class="font-size-16 pr-15">
{@html $view.description}
</div>
<!-- TODO: episodes list -->
{#if $view.episodes || $view.nextAiringEpisode?.episode}
<table class="table table-hover w-500 table-auto">
<thead>
<tr>
<th class="px-0"><h2 class="title font-weight-bold text-white pt-20 mb-5">Episodes</h2></th>
<th />
</tr>
</thead>
<tbody>
{#each Array(Math.min($view.episodes, $view.nextAiringEpisode?.episode - 1)) as _, i}
{@const index = Math.min($view.episodes, $view.nextAiringEpisode?.episode - 1) - i - 1}
<tr class="font-size-20 py-10 pointer" on:click={() => playAnime(index + 1)}>
<td class="w-full">Episode {index + 1}</td>
<td class="material-icons text-right">play_arrow</td>
</tr>
{/each}
</tbody>
</table>
{/if}
</div>
<div class="col-md-3 px-sm-0 px-20">
<h1 class="title font-weight-bold text-white">Details</h1>

View file

@ -863,9 +863,13 @@
.player {
user-select: none;
font-family: Roboto, Arial, Helvetica, sans-serif;
background: #000;
background-color: var(--dark-color-light);
will-change: width;
}
.player.miniplayer{
background: #00000066;
backdrop-filter: blur(3px);
}
.pip :global(canvas) {
left: 99.9% !important;

View file

@ -37,15 +37,15 @@ function traceAnime (image, type) { // WAIT lookup logic
if (type === 'file') {
const reader = new FileReader()
reader.onload = e => {
halfmoon.initStickyAlert({
content: `Looking up anime for image.<br><img class="w-200 rounded pt-5" src="${e.target.result}">`
})
// halfmoon.initStickyAlert({
// content: `Looking up anime for image.<br><img class="w-200 rounded pt-5" src="${e.target.result}">`
// })
}
reader.readAsDataURL(image.get('image'))
} else {
halfmoon.initStickyAlert({
content: `Looking up anime for image.<br><img class="w-200 rounded pt-5" src="${image}">`
})
// halfmoon.initStickyAlert({
// content: `Looking up anime for image.<br><img class="w-200 rounded pt-5" src="${image}">`
// })
}
let options
let url = `https://api.trace.moe/search?cutBorders&url=${image}`
@ -62,12 +62,12 @@ function traceAnime (image, type) { // WAIT lookup logic
// viewMedia(res.data.Media, result[0].episode)
// TODO: view media
} else {
halfmoon.initStickyAlert({
content: 'Couldn\'t find anime for specified image! Try to remove black bars, or use a more detailed image.',
title: 'Search Failed',
alertType: 'alert-danger',
fillType: ''
})
// halfmoon.initStickyAlert({
// content: 'Couldn\'t find anime for specified image! Try to remove black bars, or use a more detailed image.',
// title: 'Search Failed',
// alertType: 'alert-danger',
// fillType: ''
// })
}
})
}
@ -168,12 +168,12 @@ export async function resolveFileMedia (opts) {
}
} else {
console.log('error in parsing!', opts.media, tempMedia)
halfmoon.initStickyAlert({
content: `Failed resolving anime episode!<br>${opts.media.title.userPreferred} - ${epMax}`,
title: 'Parsing Error',
alertType: 'alert-secondary',
fillType: ''
})
// halfmoon.initStickyAlert({
// content: `Failed resolving anime episode!<br>${opts.media.title.userPreferred} - ${epMax}`,
// title: 'Parsing Error',
// alertType: 'alert-secondary',
// fillType: ''
// })
// something failed, most likely couldnt find an edge or processing failed, force episode number even if its invalid/out of bounds, better than nothing
if (opts.episode.constructor === Array) {
episode = `${Number(praseObj.episode_number[0])} ~ ${Number(praseObj.episode_number[praseObj.episode_number.length - 1])}`