Skip to content

Commit

Permalink
refactor: use action.infos directly
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Apr 26, 2024
1 parent 4979500 commit b4853c8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions registry/lib/plugins/video/download/wasm-output/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getCacheOrGet, httpGet, toastProgress, toBlobUrl } from './utils'
const ffmpeg = new FFmpeg()

async function loadFFmpeg() {
const toast = Toast.info('初始化', pluginTitle)
const toast = Toast.info('正在加载 FFmpeg', `${pluginTitle} - 初始化`)
await ffmpeg.load({
workerLoadURL: toBlobUrl(
await getCacheOrGet(
Expand Down Expand Up @@ -88,20 +88,16 @@ export async function run(action: DownloadVideoAction) {
await loadFFmpeg()
}

const pages = lodash.chunk(
action.infos.flatMap(it => it.titledFragments),
2,
)

const { dashAudioExtension, dashFlacAudioExtension, dashVideoExtension } =
getComponentSettings<Options>('downloadVideo').options

const pages = action.infos
for (let i = 0; i < pages.length; i++) {
const page = pages[i]
const [video, audio] = page
const [video, audio] = page.titledFragments
if (
!(
page.length === 2 &&
page.fragments.length === 2 &&
video.extension === dashVideoExtension &&
(audio.extension === dashAudioExtension || audio.extension === dashFlacAudioExtension)
)
Expand Down

0 comments on commit b4853c8

Please sign in to comment.