mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-13 20:17:04 +02:00
web/queue: fix filename on downloads, add mimetype, remove duplicates
filename is no longer passed to workers for no reason
This commit is contained in:
parent
50df95b212
commit
61efa619a2
@ -34,13 +34,14 @@
|
|||||||
|
|
||||||
const download = (file: File) =>
|
const download = (file: File) =>
|
||||||
downloadFile({
|
downloadFile({
|
||||||
file,
|
file: new File([file], info.filename, {
|
||||||
|
type: info.mimeType,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="processing-item">
|
<div class="processing-item">
|
||||||
<div class="processing-info">
|
<div class="processing-info">
|
||||||
|
|
||||||
<div class="file-title">
|
<div class="file-title">
|
||||||
<div class="processing-type">
|
<div class="processing-type">
|
||||||
<svelte:component this={itemIcons[info.mediaType]} />
|
<svelte:component this={itemIcons[info.mediaType]} />
|
||||||
@ -56,7 +57,7 @@
|
|||||||
<ProgressBar
|
<ProgressBar
|
||||||
percentage={progress?.percentage}
|
percentage={progress?.percentage}
|
||||||
workerId={pipeline.workerId}
|
workerId={pipeline.workerId}
|
||||||
runningWorkerId={runningWorkerId}
|
{runningWorkerId}
|
||||||
completedWorkers={info.completedWorkers}
|
completedWorkers={info.completedWorkers}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
@ -69,7 +70,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if info.state === "running"}
|
{#if info.state === "running"}
|
||||||
{(info.completedWorkers?.length || 0) + 1}/{info.pipeline.length}
|
{#if info.pipeline.length > 1}
|
||||||
|
{(info.completedWorkers?.length || 0) + 1}/{info.pipeline.length}
|
||||||
|
{/if}
|
||||||
{#if runningWorker && progress && progress.percentage}
|
{#if runningWorker && progress && progress.percentage}
|
||||||
{$t(`queue.state.running.${runningWorker.type}`)}: {Math.ceil(
|
{$t(`queue.state.running.${runningWorker.type}`)}: {Math.ceil(
|
||||||
progress.percentage
|
progress.percentage
|
||||||
@ -210,7 +213,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(hover: none) {
|
@media (hover: none) {
|
||||||
.processing-info {
|
.processing-info {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
@ -35,7 +35,6 @@ export const createRemuxPipeline = (file: File) => {
|
|||||||
type: file.type,
|
type: file.type,
|
||||||
extension: file.name.split(".").pop(),
|
extension: file.name.split(".").pop(),
|
||||||
},
|
},
|
||||||
filename: file.name,
|
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@ -45,6 +44,7 @@ export const createRemuxPipeline = (file: File) => {
|
|||||||
state: "waiting",
|
state: "waiting",
|
||||||
pipeline,
|
pipeline,
|
||||||
filename: file.name,
|
filename: file.name,
|
||||||
|
mimeType: file.type,
|
||||||
mediaType,
|
mediaType,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -82,7 +82,6 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse) => {
|
|||||||
type: mime.getType(info.filename) || undefined,
|
type: mime.getType(info.filename) || undefined,
|
||||||
extension: info.filename.split(".").pop(),
|
extension: info.filename.split(".").pop(),
|
||||||
},
|
},
|
||||||
filename: info.filename,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -91,6 +90,7 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse) => {
|
|||||||
state: "waiting",
|
state: "waiting",
|
||||||
pipeline,
|
pipeline,
|
||||||
filename: info.filename,
|
filename: info.filename,
|
||||||
|
mimeType: mime.getType(info.filename) || undefined,
|
||||||
mediaType: "video",
|
mediaType: "video",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ export const runRemuxWorker = async (
|
|||||||
parentId: string,
|
parentId: string,
|
||||||
files: CobaltFileReference[],
|
files: CobaltFileReference[],
|
||||||
args: string[],
|
args: string[],
|
||||||
output: FileInfo,
|
output: FileInfo
|
||||||
filename: string
|
|
||||||
) => {
|
) => {
|
||||||
const worker = new RemuxWorker();
|
const worker = new RemuxWorker();
|
||||||
|
|
||||||
@ -55,7 +54,6 @@ export const runRemuxWorker = async (
|
|||||||
files,
|
files,
|
||||||
args,
|
args,
|
||||||
output,
|
output,
|
||||||
filename,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -165,14 +163,13 @@ export const startWorker = async ({ worker, workerId, parentId, workerArgs }: Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files.length > 0 && workerArgs.ffargs && workerArgs.output && workerArgs.filename) {
|
if (files.length > 0 && workerArgs.ffargs && workerArgs.output) {
|
||||||
await runRemuxWorker(
|
await runRemuxWorker(
|
||||||
workerId,
|
workerId,
|
||||||
parentId,
|
parentId,
|
||||||
files,
|
files,
|
||||||
workerArgs.ffargs,
|
workerArgs.ffargs,
|
||||||
workerArgs.output,
|
workerArgs.output,
|
||||||
workerArgs.filename
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -9,6 +9,7 @@ export type CobaltQueueBaseItem = {
|
|||||||
pipeline: CobaltPipelineItem[],
|
pipeline: CobaltPipelineItem[],
|
||||||
// TODO: metadata
|
// TODO: metadata
|
||||||
filename: string,
|
filename: string,
|
||||||
|
mimeType?: string,
|
||||||
mediaType: CobaltPipelineResultFileType,
|
mediaType: CobaltPipelineResultFileType,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ export type CobaltWorkerArgs = {
|
|||||||
url?: string,
|
url?: string,
|
||||||
ffargs?: string[],
|
ffargs?: string[],
|
||||||
output?: FileInfo,
|
output?: FileInfo,
|
||||||
filename?: string,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CobaltPipelineItem = {
|
export type CobaltPipelineItem = {
|
||||||
|
@ -27,7 +27,7 @@ const ff = new LibAVWrapper((progress) => {
|
|||||||
|
|
||||||
ff.init();
|
ff.init();
|
||||||
|
|
||||||
const remux = async (files: CobaltFileReference[], args: string[], output: FileInfo, filename: string) => {
|
const remux = async (files: CobaltFileReference[], args: string[], output: FileInfo) => {
|
||||||
if (!(files && output && args)) return;
|
if (!(files && output && args)) return;
|
||||||
|
|
||||||
await ff.init();
|
await ff.init();
|
||||||
@ -86,8 +86,7 @@ const remux = async (files: CobaltFileReference[], args: string[], output: FileI
|
|||||||
|
|
||||||
self.postMessage({
|
self.postMessage({
|
||||||
cobaltRemuxWorker: {
|
cobaltRemuxWorker: {
|
||||||
render,
|
render
|
||||||
filename
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -99,8 +98,8 @@ const remux = async (files: CobaltFileReference[], args: string[], output: FileI
|
|||||||
self.onmessage = async (event: MessageEvent) => {
|
self.onmessage = async (event: MessageEvent) => {
|
||||||
const ed = event.data.cobaltRemuxWorker;
|
const ed = event.data.cobaltRemuxWorker;
|
||||||
if (ed) {
|
if (ed) {
|
||||||
if (ed.files && ed.args && ed.output && ed.filename) {
|
if (ed.files && ed.args && ed.output) {
|
||||||
await remux(ed.files, ed.args, ed.output, ed.filename);
|
await remux(ed.files, ed.args, ed.output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user