mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-20 08:02:12 +00:00
fix: external player URL encoding
fix: al entry running when not necessary fix: androidTV getting stuck in torrent select modal fix: bottom of settings not visible on medium size displays
This commit is contained in:
parent
aeee8f74e5
commit
7b3020bf35
6 changed files with 45 additions and 39 deletions
|
|
@ -281,6 +281,7 @@ class AnilistClient {
|
|||
**/
|
||||
async alSearchCompound (flattenedTitles) {
|
||||
if (!flattenedTitles.length) return []
|
||||
// isAdult doesn't need an extra variable, as the title is the same regardless of type, so we re-use the same variable for adult and non-adult requests
|
||||
/** @type {Record<`v${number}`, string>} */
|
||||
const requestVariables = flattenedTitles.reduce((obj, { title, isAdult }, i) => {
|
||||
if (isAdult) return obj
|
||||
|
|
@ -338,41 +339,46 @@ class AnilistClient {
|
|||
async alEntry (filemedia) {
|
||||
// check if values exist
|
||||
if (filemedia.media && alToken) {
|
||||
if (filemedia.failed) return
|
||||
const { media } = filemedia
|
||||
const { media, failed } = filemedia
|
||||
|
||||
if (failed) return
|
||||
if (media.status !== 'FINISHED' && media.status !== 'RELEASING') return
|
||||
|
||||
// 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 && (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
|
||||
if (videoEpisode && mediaEpisode && (mediaEpisode >= videoEpisode)) {
|
||||
// check user's own watch progress
|
||||
const lists = media.mediaListEntry?.customLists.filter(list => list.enabled).map(list => list.name) || []
|
||||
// some anime/OVA's can have a single episode, or some movies can have multiple episodes
|
||||
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
|
||||
|
||||
const status = media.mediaListEntry?.status === 'REPEATING' ? 'REPEATING' : 'CURRENT'
|
||||
if (!videoEpisode || !mediaEpisode) return
|
||||
// check episode range, safety check if `failed` didn't catch this
|
||||
if (videoEpisode > mediaEpisode) return
|
||||
|
||||
if (!media.mediaListEntry || (media.mediaListEntry?.progress <= videoEpisode) || singleEpisode) {
|
||||
const variables = {
|
||||
repeat: media.mediaListEntry?.repeat || 0,
|
||||
id: media.id,
|
||||
status,
|
||||
episode: videoEpisode,
|
||||
lists
|
||||
}
|
||||
if (videoEpisode === mediaEpisode) {
|
||||
variables.status = 'COMPLETED'
|
||||
if (media.mediaListEntry?.status === 'REPEATING') variables.repeat = media.mediaListEntry.repeat + 1
|
||||
}
|
||||
if (!lists.includes('Watched using Miru')) {
|
||||
variables.lists.push('Watched using Miru')
|
||||
}
|
||||
await this.entry(variables)
|
||||
this.userLists.value = this.getUserLists()
|
||||
}
|
||||
}
|
||||
const lists = media.mediaListEntry?.customLists.filter(list => list.enabled).map(list => list.name) || []
|
||||
|
||||
const status = media.mediaListEntry?.status === 'REPEATING' ? 'REPEATING' : 'CURRENT'
|
||||
const progress = media.mediaListEntry?.progress
|
||||
|
||||
// check user's own watch progress
|
||||
if (progress > videoEpisode) return
|
||||
if (progress === videoEpisode && videoEpisode !== mediaEpisode && !singleEpisode) return
|
||||
|
||||
const variables = {
|
||||
repeat: media.mediaListEntry?.repeat || 0,
|
||||
id: media.id,
|
||||
status,
|
||||
episode: videoEpisode,
|
||||
lists
|
||||
}
|
||||
if (videoEpisode === mediaEpisode) {
|
||||
variables.status = 'COMPLETED'
|
||||
if (media.mediaListEntry?.status === 'REPEATING') variables.repeat = media.mediaListEntry.repeat + 1
|
||||
}
|
||||
if (!lists.includes('Watched using Miru')) {
|
||||
variables.lists.push('Watched using Miru')
|
||||
}
|
||||
await this.entry(variables)
|
||||
this.userLists.value = this.getUserLists()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ export default class TorrentClient extends WebTorrent {
|
|||
found.select()
|
||||
this.current = found
|
||||
if (data.data.external && this.player) {
|
||||
this.playerProcess = spawn(this.player, ['http://localhost:' + this.server.address().port + found.streamURL])
|
||||
this.playerProcess = spawn(this.player, [encodeURI('http://localhost:' + this.server.address().port + found.streamURL)])
|
||||
this.playerProcess.stdout.on('data', () => {})
|
||||
const startTime = Date.now()
|
||||
this.playerProcess.once('close', () => {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
}
|
||||
|
||||
export let miniplayer = false
|
||||
$condition = () => !miniplayer && SUPPORTS.keybinds
|
||||
$condition = () => !miniplayer && SUPPORTS.keybinds && !document.querySelector('.modal.show')
|
||||
export let page
|
||||
export let files = []
|
||||
$: updateFiles(files)
|
||||
|
|
|
|||
|
|
@ -145,25 +145,25 @@
|
|||
<div class='root h-full w-full overflow-y-md-auto p-20' use:smoothScroll>
|
||||
<PlayerSettings bind:settings={$settings} />
|
||||
<!-- spacing element to make space for miniplayer on mobile -->
|
||||
<div class='h-250 d-md-none' />
|
||||
<div class='h-250' />
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<div class='root h-full w-full overflow-y-md-auto p-20' use:smoothScroll>
|
||||
<TorrentSettings bind:settings={$settings} />
|
||||
<div class='h-250 d-md-none' />
|
||||
<div class='h-250' />
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<div class='root h-full w-full overflow-y-md-auto p-20' use:smoothScroll>
|
||||
<InterfaceSettings bind:settings={$settings} />
|
||||
<div class='h-250 d-md-none' />
|
||||
<div class='h-250' />
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<div class='root h-full w-full overflow-y-md-auto p-20' use:smoothScroll>
|
||||
<AppSettings />
|
||||
<div class='h-250 d-md-none' />
|
||||
<div class='h-250' />
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@
|
|||
class='form-control bg-dark border-left-0'
|
||||
autocomplete='off'
|
||||
data-option='search'
|
||||
placeholder='Find a specific torrent...' bind:value={searchText} on:keydown|stopPropagation|stopImmediatePropagation|capture />
|
||||
placeholder='Find a specific torrent...' bind:value={searchText} />
|
||||
</div>
|
||||
<div class='row mt-20 mb-10'>
|
||||
<div class='col-12 col-md-6 d-flex align-items-center justify-content-around'>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "5.1.1",
|
||||
"version": "5.1.2",
|
||||
"private": true,
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||
|
|
|
|||
Loading…
Reference in a new issue