SrGooglo f62e885c65 Refactor file upload system with new transformations pipeline
The commit refactors the chunked upload system to support a transformation pipeline. Key changes include:

- Replace SSE field names for consistency (sseChannelId, sseUrl)
- Fix progress reporting structure with state and percent fields
- Add transformation handlers (a-dash, mq-hls, img-compress, video-compress)
- Create new Upload class with clear separation of concerns
- Improve file processing workflow with better directory structure
- Fix typo in UploadButton component (progess → progress)
- Remove deprecated file processing services
2025-04-24 06:06:21 +00:00

39 lines
817 B
JavaScript

import path from "node:path"
import SegmentedAudioMPDJob from "@shared-classes/SegmentedAudioMPDJob"
export default async ({ filePath, workPath, onProgress }) => {
return new Promise(async (resolve, reject) => {
const outputDir = path.resolve(workPath, "a-dash")
const job = new SegmentedAudioMPDJob({
input: filePath,
outputDir: outputDir,
// set to default as raw flac
audioCodec: "flac",
audioBitrate: "default",
audioSampleRate: "default",
})
job.on("start", () => {
console.log("A-DASH started")
})
job.on("end", (data) => {
console.log("A-DASH completed", data)
resolve(data)
})
job.on("progress", (progress) => {
if (typeof onProgress === "function") {
onProgress({
percent: progress,
state: "transmuxing",
})
}
})
job.run()
})
}