Skip to content

Commit

Permalink
fix(video): preserve raw files / output folder path on retry
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Aug 19, 2024
1 parent 068a9c3 commit 82a3bfd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/server/video-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class VideoQueue {
}

public addVideo(partialVideo: AddVideoPayload) {
const isUpdate = partialVideo.id;
const id = partialVideo.id ?? randomUUID();
const date = partialVideo.date ?? new Date().toISOString();
const video: Video = {
Expand All @@ -36,8 +37,8 @@ class VideoQueue {
output: '',
errorCode: undefined,
// Raw files and output files are stored in a folder named after the video id to avoid overwriting files
rawFilesFolderPath: path.join(partialVideo.rawFilesFolderPath, id),
outputFolderPath: path.join(partialVideo.outputFolderPath, id),
rawFilesFolderPath: isUpdate ? partialVideo.rawFilesFolderPath : path.join(partialVideo.rawFilesFolderPath, id),
outputFolderPath: isUpdate ? partialVideo.outputFolderPath : path.join(partialVideo.outputFolderPath, id),
};
this.videos.push(video);
this.abortControllers[id] = new AbortController();
Expand Down

0 comments on commit 82a3bfd

Please sign in to comment.