Backend MP4 conversion (#23)
* ADD conversion queue * ADD RemuxService for MP4 conversion * REMOVE unused conversion queue * REORGANISE Job-related classes * ADD Job stages * REVERT to old commit, using Spring Async instead * ADD asynchronous processing for video tasks * PATCH and streamline progress tracking * ADD asynchronous video processing and job restructuring * REFACTOR job service method * ADD job remux functionality * ADD remuxing endpoint * PATCH complete flag not updating in API response * ADD progress type in frontend * ADD reset functionality for job status * PATCH missing progress bar for subsequent exports * REDESIGN settings box * ADD tracking video file conversion in frontend * PATCH extension bug * REMOVE autowired decorator
This commit is contained in:
31
src/main/java/com/ddf/vodsystem/dto/Job.java
Normal file
31
src/main/java/com/ddf/vodsystem/dto/Job.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.ddf.vodsystem.dto;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Job {
|
||||
private String uuid;
|
||||
private File inputFile;
|
||||
private File outputFile;
|
||||
|
||||
// configs
|
||||
private VideoMetadata inputVideoMetadata;
|
||||
private VideoMetadata outputVideoMetadata = new VideoMetadata();
|
||||
|
||||
// security
|
||||
private SecurityContext securityContext;
|
||||
|
||||
// job status
|
||||
private JobStatus status = new JobStatus();
|
||||
|
||||
public Job(String uuid, File inputFile, File outputFile, VideoMetadata inputVideoMetadata) {
|
||||
this.uuid = uuid;
|
||||
this.inputFile = inputFile;
|
||||
this.outputFile = outputFile;
|
||||
this.inputVideoMetadata = inputVideoMetadata;
|
||||
}
|
||||
}
|
||||
11
src/main/java/com/ddf/vodsystem/dto/JobStatus.java
Normal file
11
src/main/java/com/ddf/vodsystem/dto/JobStatus.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.ddf.vodsystem.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class JobStatus {
|
||||
private ProgressTracker process = new ProgressTracker();
|
||||
private ProgressTracker conversion = new ProgressTracker();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
package com.ddf.vodsystem.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class ProgressTracker {
|
||||
private float progress;
|
||||
private float progress = 0.0f;
|
||||
private boolean isComplete = false;
|
||||
|
||||
public ProgressTracker(float initialProgress) {
|
||||
this.progress = initialProgress;
|
||||
public synchronized float getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(float newProgress) {
|
||||
public synchronized boolean isComplete() {
|
||||
return isComplete;
|
||||
}
|
||||
|
||||
public synchronized void setProgress(float newProgress) {
|
||||
if (newProgress < 0 || newProgress > 1) {
|
||||
throw new IllegalArgumentException("Progress must be between 0 and 1");
|
||||
}
|
||||
this.progress = newProgress;
|
||||
}
|
||||
|
||||
public synchronized void markComplete() {
|
||||
this.isComplete = true;
|
||||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
this.progress = 0.0f;
|
||||
this.isComplete = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user