web/queue: use the updated local processing api response

& finally remove mime from the web build
This commit is contained in:
wukko 2025-03-19 12:25:51 +06:00
parent e497ea51f1
commit 9eb342e6d2
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2
2 changed files with 19 additions and 16 deletions

View File

@ -1,5 +1,3 @@
import mime from "mime";
import { addItem } from "$lib/state/queen-bee/queue";
import { openQueuePopover } from "$lib/state/queue-visibility";
@ -55,6 +53,9 @@ export const createRemuxPipeline = (file: File) => {
}
export const createSavePipeline = (info: CobaltLocalProcessingResponse, request: CobaltSaveRequestBody) => {
// TODO: proper error here
if (!(info.output?.filename && info.output?.type)) return;
const parentId = crypto.randomUUID();
const pipeline: CobaltPipelineItem[] = [];
@ -82,9 +83,8 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse, request:
"-c:a", "copy"
],
output: {
// TODO: return mime type from api to avoid dragging a big ass package into web build
type: mime.getType(info.filename) || undefined,
format: info.filename.split(".").pop(),
type: info.output.type,
format: info.output.filename.split(".").pop(),
},
},
});
@ -95,8 +95,8 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse, request:
pipeline,
canRetry: true,
originalRequest: request,
filename: info.filename,
mimeType: mime.getType(info.filename) || undefined,
filename: info.output.filename,
mimeType: info.output.type,
mediaType: "video",
});

View File

@ -45,20 +45,23 @@ type CobaltTunnelResponse = {
export type CobaltLocalProcessingResponse = {
status: CobaltResponseType.LocalProcessing,
tunnel: string[],
// TODO: proper type for processing types
type: string,
service: string,
filename: string,
tunnel: string[],
metadata?: {
album?: string,
copyright?: string,
title?: string,
artist?: string,
track?: string,
date?: string
output?: {
type?: string, // mimetype
filename?: string,
metadata?: {
album?: string,
copyright?: string,
title?: string,
artist?: string,
track?: string,
date?: string
},
},
audio?: {