mirror of
https://github.com/NoCrypt/migu.git
synced 2026-03-11 17:45:32 +00:00
feat: allow to change source during batch playback
fix: play desired ep in batch
This commit is contained in:
parent
115cf5e56a
commit
5996f4083d
5 changed files with 12 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "2.13.5",
|
||||
"version": "2.13.6",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"main": "src/index.js",
|
||||
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { writable, get } from 'svelte/store'
|
|||
import { resolveFileMedia } from '@/modules/anime.js'
|
||||
import { videoRx } from '@/modules/util.js'
|
||||
import { title } from '../Menubar.svelte'
|
||||
import { tick } from 'svelte'
|
||||
|
||||
const episodeRx = /Episode (\d+) - (.*)/
|
||||
|
||||
|
|
@ -29,6 +30,9 @@ function handleCurrent ({ detail }) {
|
|||
|
||||
export function findInCurrent (obj) {
|
||||
const oldNowPlaying = get(nowPlaying)
|
||||
|
||||
if (oldNowPlaying.media?.id === obj.media.id && oldNowPlaying.episode === obj.episode) return false
|
||||
|
||||
const fileList = get(files)
|
||||
|
||||
const targetFile = fileList.find(file => file.media?.media?.id === obj.media.id && file.media?.episode === obj.episode)
|
||||
|
|
@ -94,6 +98,7 @@ async function handleFiles (files) {
|
|||
|
||||
if (nowPlaying?.episode && nowPlaying.episode !== 1) {
|
||||
const file = videoFiles.find(({ media }) => media.episode === nowPlaying.episode)
|
||||
await tick()
|
||||
playFile(file || 0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ w2gEmitter.on('setindex', ({ detail }) => {
|
|||
export function playFile (file) {
|
||||
if (typeof value === 'number') {
|
||||
handleCurrent(videos?.[file])
|
||||
} else if (videos.includes(file)) {
|
||||
} else {
|
||||
handleCurrent(file)
|
||||
}
|
||||
}
|
||||
|
|
@ -194,7 +194,6 @@ $: checkAvail(media)
|
|||
let hasNext = false
|
||||
let hasLast = false
|
||||
function checkAvail () {
|
||||
console.log(media)
|
||||
if ((media?.media?.nextAiringEpisode?.episode - 1 || media?.media?.episodes) > media?.episode) {
|
||||
hasNext = true
|
||||
} else if (videos.indexOf(current) !== videos.length - 1) {
|
||||
|
|
|
|||
|
|
@ -60,9 +60,10 @@ if (!isDev && !video.canPlayType('audio/mp4; codecs="ac-3"')) {
|
|||
}
|
||||
video.remove()
|
||||
|
||||
export function playAnime (media, episode = 1) {
|
||||
export function playAnime (media, episode = 1, force) {
|
||||
episode = Number(episode)
|
||||
episode = isNaN(episode) ? 1 : episode
|
||||
if (findInCurrent({ media, episode })) return
|
||||
if (!force && findInCurrent({ media, episode })) return
|
||||
rss.set({ media, episode })
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ function getPlayText (media) {
|
|||
const { status, progress } = media.mediaListEntry
|
||||
if (progress) {
|
||||
if (status === 'COMPLETED') return 'Rewatch'
|
||||
return 'Continue ' + Math.min(getMediaMaxEp(media), progress + 1)
|
||||
return 'Continue ' + Math.min(getMediaMaxEp(media, true), progress + 1)
|
||||
}
|
||||
}
|
||||
return 'Play'
|
||||
|
|
@ -94,7 +94,7 @@ async function play () {
|
|||
}
|
||||
}
|
||||
}
|
||||
playAnime(media, ep)
|
||||
playAnime(media, ep, true)
|
||||
media = null
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue