Skip to content

Commit

Permalink
fix: dont mark as complete when not necessary
Browse files Browse the repository at this point in the history
fix: dont spam failed resolve media
  • Loading branch information
ThaUnknown committed Apr 18, 2024
1 parent 2f9db0f commit 6017ab1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions common/components/cards/EpisodeCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<div class='item d-flex flex-column h-full pointer content-visibility-auto'>
<div class='image h-200 w-full position-relative rounded overflow-hidden d-flex justify-content-between align-items-end text-white' class:bg-black={episodeThumbnail === ' '}>
<img loading='lazy' src={episodeThumbnail} alt='cover' class='cover-img w-full h-full position-absolute' style:--color={media?.coverImage?.color || '#1890ff'} />
{#if data.failed}
<div class='material-symbols-outlined pl-10 pt-10 position-absolute top-0 left-0 text-danger filled font-weight-medium' title='Failed to resolve media z-10'>
sync_problem
</div>
{/if}
<div class='pl-10 pb-10 material-symbols-outlined filled z-10'>play_arrow</div>
<div class='pr-15 pb-10 font-size-16 font-weight-medium z-10'>
{#if media?.duration}
Expand Down
5 changes: 5 additions & 0 deletions common/components/cards/EpisodePreviewCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
on:loadeddata={() => { hide = false }}
autoplay />
{/if}
{#if data.failed}
<div class='material-symbols-outlined pl-10 pt-10 position-absolute top-0 left-0 text-danger filled font-weight-medium z-10' title='Failed to resolve media'>
sync_problem
</div>
{/if}
<div class='pl-15 pb-10 material-symbols-outlined filled z-10'>play_arrow</div>
<div class='pr-20 pb-10 font-size-16 font-weight-medium z-10'>
{#if media?.duration}
Expand Down
3 changes: 2 additions & 1 deletion common/modules/anilist.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,12 @@ class AnilistClient {
async alEntry (filemedia) {
// check if values exist
if (filemedia.media && alToken) {
if (filemedia.failed) return
const { media } = filemedia
// check if media can even be watched, ex: it was resolved incorrectly
if (media.status === 'FINISHED' || media.status === 'RELEASING') {
// some anime/OVA's can have a single episode, or some movies can have multiple episodes
const singleEpisode = (!media.episodes || (media.format === 'MOVIE' && media.episodes === 1)) && 1
const singleEpisode = ((!media.episodes && (Number(filemedia.episode) === 1 || isNaN(Number(filemedia.episode)))) || (media.format === 'MOVIE' && media.episodes === 1)) && 1 // movie check
const videoEpisode = Number(filemedia.episode) || singleEpisode
const mediaEpisode = media.episodes || media.nextAiringEpisode?.episode || singleEpisode
// check episode range
Expand Down
7 changes: 1 addition & 6 deletions common/modules/animeresolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,7 @@ export default new class AnimeResolver {

if (!edge) {
const obj = { media, episode: episode - offset, offset, increment, rootMedia, failed: true }
if (!force) {
console.warn('Error in parsing!', obj)
toast('Parsing Error', {
description: `Failed resolving anime episode!\n${media.title.userPreferred} - ${episode - offset}`
})
}
if (!force) console.warn('Error in parsing!', obj)
return obj
}
media = await this.getAnimeById(edge.id)
Expand Down

0 comments on commit 6017ab1

Please sign in to comment.