mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-29 13:00:12 +02:00
web/workers: split up args by type
This commit is contained in:
parent
53ca7700a5
commit
a183265838
@ -95,6 +95,7 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse, request:
|
|||||||
workerId: crypto.randomUUID(),
|
workerId: crypto.randomUUID(),
|
||||||
parentId,
|
parentId,
|
||||||
workerArgs: {
|
workerArgs: {
|
||||||
|
files: [],
|
||||||
ffargs,
|
ffargs,
|
||||||
output: {
|
output: {
|
||||||
type: info.output.type,
|
type: info.output.type,
|
||||||
|
@ -18,11 +18,11 @@ export const startWorker = async ({ worker, workerId, parentId, workerArgs }: Co
|
|||||||
|
|
||||||
switch (worker) {
|
switch (worker) {
|
||||||
case "remux":
|
case "remux":
|
||||||
if (workerArgs?.files) {
|
if (workerArgs.files) {
|
||||||
files = workerArgs.files;
|
files = workerArgs.files;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files?.length === 0) {
|
if (files.length === 0) {
|
||||||
const parent = get(queue)[parentId];
|
const parent = get(queue)[parentId];
|
||||||
if (parent.state === "running" && parent.pipelineResults.length) {
|
if (parent.state === "running" && parent.pipelineResults.length) {
|
||||||
files = parent.pipelineResults;
|
files = parent.pipelineResults;
|
||||||
@ -42,9 +42,7 @@ export const startWorker = async ({ worker, workerId, parentId, workerArgs }: Co
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "fetch":
|
case "fetch":
|
||||||
if (workerArgs?.url) {
|
await runFetchWorker(workerId, parentId, workerArgs.url)
|
||||||
await runFetchWorker(workerId, parentId, workerArgs.url)
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,28 @@ export type CobaltWorkerProgress = {
|
|||||||
size: number,
|
size: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CobaltWorkerArgs = {
|
export type CobaltFetchWorkerArgs = { url: string };
|
||||||
files?: CobaltFileReference[],
|
|
||||||
url?: string,
|
export type CobaltRemuxWorkerArgs = {
|
||||||
ffargs?: string[],
|
files: CobaltFileReference[],
|
||||||
output?: FileInfo,
|
ffargs: string[],
|
||||||
|
output: FileInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CobaltPipelineItem = {
|
export type CobaltPipelineItemBase = {
|
||||||
worker: CobaltWorkerType,
|
worker: CobaltWorkerType,
|
||||||
workerId: string,
|
workerId: string,
|
||||||
parentId: string,
|
parentId: string,
|
||||||
workerArgs: CobaltWorkerArgs,
|
};
|
||||||
|
|
||||||
|
type CobaltRemuxPipelineItem = CobaltPipelineItemBase & {
|
||||||
|
worker: "remux",
|
||||||
|
workerArgs: CobaltRemuxWorkerArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CobaltFetchPipelineItem = CobaltPipelineItemBase & {
|
||||||
|
worker: "fetch",
|
||||||
|
workerArgs: CobaltFetchWorkerArgs,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CobaltPipelineItem = CobaltRemuxPipelineItem | CobaltFetchPipelineItem;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user