mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-21 00:22:08 +00:00
fix: exclude unsupported codeds from tosho
fix: undefined episode on cards
This commit is contained in:
parent
f13848d9f8
commit
98beb4e8e4
5 changed files with 31 additions and 23 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Miru",
|
"name": "Miru",
|
||||||
"version": "4.1.1",
|
"version": "4.1.2",
|
||||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||||
"main": "build/main.js",
|
"main": "build/main.js",
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,16 @@
|
||||||
{data.media?.title.userPreferred || data.parseObject.anime_title}
|
{data.media?.title.userPreferred || data.parseObject.anime_title}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-5 d-flex flex-column align-items-end text-right'>
|
{#if data.episode}
|
||||||
<div class='text-white'>
|
<div class='col-5 d-flex flex-column align-items-end text-right'>
|
||||||
Episode {data.episode}
|
<div class='text-white'>
|
||||||
|
Episode {data.episode}
|
||||||
|
</div>
|
||||||
|
<div class='text-muted font-size-12 title overflow-hidden'>
|
||||||
|
{data.episodeData?.title || ''}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='text-muted font-size-12 title overflow-hidden'>
|
{/if}
|
||||||
{data.episodeData?.title || ''}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,16 @@
|
||||||
{data.media?.title.userPreferred || data.parseObject.anime_title}
|
{data.media?.title.userPreferred || data.parseObject.anime_title}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-5 d-flex flex-column align-items-end text-right'>
|
{#if data.episode}
|
||||||
<div class='text-white'>
|
<div class='col-5 d-flex flex-column align-items-end text-right'>
|
||||||
Episode {data.episode}
|
<div class='text-white'>
|
||||||
|
Episode {data.episode}
|
||||||
|
</div>
|
||||||
|
<div class='text-muted font-size-12 title overflow-hidden'>
|
||||||
|
{data.episodeData?.title || ''}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='text-muted font-size-12 title overflow-hidden'>
|
{/if}
|
||||||
{data.episodeData?.title || ''}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class='w-full text-muted description overflow-hidden pt-10'>
|
<div class='w-full text-muted description overflow-hidden pt-10'>
|
||||||
{data.episodeData?.description || media?.description?.replace(/<[^>]*>/g, '') || ''}
|
{data.episodeData?.description || media?.description?.replace(/<[^>]*>/g, '') || ''}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,27 @@
|
||||||
import { mapBestRelease } from '../anime.js'
|
import { mapBestRelease } from '../anime.js'
|
||||||
import { fastPrettyBytes } from '../util.js'
|
import { fastPrettyBytes } from '../util.js'
|
||||||
|
import { exclusions } from '../rss.js'
|
||||||
|
|
||||||
const toshoURL = decodeURIComponent(atob('aHR0cHM6Ly9mZWVkLmFuaW1ldG9zaG8ub3JnL2pzb24/'))
|
const toshoURL = decodeURIComponent(atob('aHR0cHM6Ly9mZWVkLmFuaW1ldG9zaG8ub3JnL2pzb24/'))
|
||||||
|
|
||||||
// TODO: exclude unsupported codecd, query resolution
|
// TODO query resolution
|
||||||
|
|
||||||
export default async function ({ media, episode }) {
|
export default async function ({ media, episode }) {
|
||||||
const mappings = await fetch('https://api.ani.zip/mappings?anilist_id=' + media.id)
|
const mappings = await fetch('https://api.ani.zip/mappings?anilist_id=' + media.id + '&qx=' + exclusions.map(e => '!' + e).join(' '))
|
||||||
const { episodes, mappings: map } = await mappings.json()
|
const { episodes, mappings: map } = await mappings.json()
|
||||||
|
const entries = []
|
||||||
|
|
||||||
const { anidbEid } = episodes[Number(episode)]
|
if (episodes[Number(episode)]) {
|
||||||
|
const { anidbEid } = episodes[Number(episode)]
|
||||||
|
|
||||||
const torrents = await fetch(toshoURL + 'eid=' + anidbEid)
|
const torrents = await fetch(toshoURL + 'eid=' + anidbEid)
|
||||||
|
|
||||||
const entries = (await torrents.json())
|
entries.push(...await torrents.json())
|
||||||
|
}
|
||||||
|
|
||||||
// look for batches
|
// look for batches
|
||||||
if (media.status === 'FINISHED' && media.episodes && media.episodes !== 1) {
|
if (map.anidb_id && (media.status === 'FINISHED' || media.episodes === 1)) {
|
||||||
const torrents = await fetch(toshoURL + 'aid=' + map.anidb_id + '&order=size-d')
|
const torrents = await fetch(toshoURL + 'aid=' + map.anidb_id + '&order=size-d' + '&qx=' + exclusions.map(e => '!' + e).join(' '))
|
||||||
|
|
||||||
const batches = (await torrents.json()).filter(entry => {
|
const batches = (await torrents.json()).filter(entry => {
|
||||||
return entry.num_files >= media.episodes
|
return entry.num_files >= media.episodes
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ class RSSMediaManager {
|
||||||
await this.lastResult
|
await this.lastResult
|
||||||
const res = (await resolveFileMedia(title))[0]
|
const res = (await resolveFileMedia(title))[0]
|
||||||
if (res.media?.id) {
|
if (res.media?.id) {
|
||||||
res.episodeData = (await getEpisodeMetadataForMedia(res.media)).find(({ number }) => number === res.episode)
|
res.episodeData = (await getEpisodeMetadataForMedia(res.media))?.find(({ number }) => number === res.episode)
|
||||||
}
|
}
|
||||||
res.onclick = () => add(link)
|
res.onclick = () => add(link)
|
||||||
return res
|
return res
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue