mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-28 04:20: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(),
|
||||
parentId,
|
||||
workerArgs: {
|
||||
files: [],
|
||||
ffargs,
|
||||
output: {
|
||||
type: info.output.type,
|
||||
|
@ -18,11 +18,11 @@ export const startWorker = async ({ worker, workerId, parentId, workerArgs }: Co
|
||||
|
||||
switch (worker) {
|
||||
case "remux":
|
||||
if (workerArgs?.files) {
|
||||
if (workerArgs.files) {
|
||||
files = workerArgs.files;
|
||||
}
|
||||
|
||||
if (files?.length === 0) {
|
||||
if (files.length === 0) {
|
||||
const parent = get(queue)[parentId];
|
||||
if (parent.state === "running" && parent.pipelineResults.length) {
|
||||
files = parent.pipelineResults;
|
||||
@ -42,9 +42,7 @@ export const startWorker = async ({ worker, workerId, parentId, workerArgs }: Co
|
||||
break;
|
||||
|
||||
case "fetch":
|
||||
if (workerArgs?.url) {
|
||||
await runFetchWorker(workerId, parentId, workerArgs.url)
|
||||
}
|
||||
await runFetchWorker(workerId, parentId, workerArgs.url)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -12,16 +12,28 @@ export type CobaltWorkerProgress = {
|
||||
size: number,
|
||||
}
|
||||
|
||||
export type CobaltWorkerArgs = {
|
||||
files?: CobaltFileReference[],
|
||||
url?: string,
|
||||
ffargs?: string[],
|
||||
output?: FileInfo,
|
||||
export type CobaltFetchWorkerArgs = { url: string };
|
||||
|
||||
export type CobaltRemuxWorkerArgs = {
|
||||
files: CobaltFileReference[],
|
||||
ffargs: string[],
|
||||
output: FileInfo,
|
||||
}
|
||||
|
||||
export type CobaltPipelineItem = {
|
||||
export type CobaltPipelineItemBase = {
|
||||
worker: CobaltWorkerType,
|
||||
workerId: 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