web: very early implementation of a fetch worker

This commit is contained in:
wukko
2025-01-30 01:04:33 +06:00
parent affe49474d
commit 5d7724762d
7 changed files with 166 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
import { addItem } from "$lib/state/queen-bee/queue";
import type { CobaltPipelineItem } from "$lib/types/workers";
import type { CobaltLocalProcessingResponse } from "$lib/types/api";
export const getMediaType = (type: string) => {
const kind = type.split('/')[0];
@@ -34,3 +35,27 @@ export const createRemuxPipeline = (file: File) => {
})
}
}
export const createSavePipeline = (info: CobaltLocalProcessingResponse) => {
const parentId = crypto.randomUUID();
const pipeline: CobaltPipelineItem[] = [];
for (const tunnel of info.tunnel) {
pipeline.push({
worker: "fetch",
workerId: crypto.randomUUID(),
parentId,
workerArgs: {
url: tunnel,
},
})
}
addItem({
id: parentId,
state: "waiting",
pipeline,
filename: info.filename,
mediaType: "video",
})
}