mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
refactor: use action.infos directly
This commit is contained in:
parent
4979500d2c
commit
b4853c8f75
@ -11,7 +11,7 @@ import { getCacheOrGet, httpGet, toastProgress, toBlobUrl } from './utils'
|
|||||||
const ffmpeg = new FFmpeg()
|
const ffmpeg = new FFmpeg()
|
||||||
|
|
||||||
async function loadFFmpeg() {
|
async function loadFFmpeg() {
|
||||||
const toast = Toast.info('初始化', pluginTitle)
|
const toast = Toast.info('正在加载 FFmpeg', `${pluginTitle} - 初始化`)
|
||||||
await ffmpeg.load({
|
await ffmpeg.load({
|
||||||
workerLoadURL: toBlobUrl(
|
workerLoadURL: toBlobUrl(
|
||||||
await getCacheOrGet(
|
await getCacheOrGet(
|
||||||
@ -88,20 +88,16 @@ export async function run(action: DownloadVideoAction) {
|
|||||||
await loadFFmpeg()
|
await loadFFmpeg()
|
||||||
}
|
}
|
||||||
|
|
||||||
const pages = lodash.chunk(
|
|
||||||
action.infos.flatMap(it => it.titledFragments),
|
|
||||||
2,
|
|
||||||
)
|
|
||||||
|
|
||||||
const { dashAudioExtension, dashFlacAudioExtension, dashVideoExtension } =
|
const { dashAudioExtension, dashFlacAudioExtension, dashVideoExtension } =
|
||||||
getComponentSettings<Options>('downloadVideo').options
|
getComponentSettings<Options>('downloadVideo').options
|
||||||
|
|
||||||
|
const pages = action.infos
|
||||||
for (let i = 0; i < pages.length; i++) {
|
for (let i = 0; i < pages.length; i++) {
|
||||||
const page = pages[i]
|
const page = pages[i]
|
||||||
const [video, audio] = page
|
const [video, audio] = page.titledFragments
|
||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
page.length === 2 &&
|
page.fragments.length === 2 &&
|
||||||
video.extension === dashVideoExtension &&
|
video.extension === dashVideoExtension &&
|
||||||
(audio.extension === dashAudioExtension || audio.extension === dashFlacAudioExtension)
|
(audio.extension === dashAudioExtension || audio.extension === dashFlacAudioExtension)
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user