Added ability for the transcoder to determine if a video file is open in another program to avoid trying to transcode/remove a partially written file; reworked the main transcode loop to handle one file at a time instead of archiving everything, then transcoding, then cleanup
This commit is contained in:
@ -40,25 +40,21 @@ public class Repository {
|
||||
}
|
||||
|
||||
// archives files in the ingest directory
|
||||
public void archiveIngest(File[] sourceFiles) {
|
||||
for (File f : sourceFiles) {
|
||||
Path filePath = Path.of(f.toString());
|
||||
String filename = filePath.getFileName().toString();
|
||||
String archivePath = Paths.get(this.archivePath, filename).toString();
|
||||
public void archiveFile(File sourceFile) {
|
||||
Path filePath = Path.of(sourceFile.toString());
|
||||
String filename = filePath.getFileName().toString();
|
||||
String archivePath = Paths.get(this.archivePath, filename).toString();
|
||||
|
||||
try {
|
||||
Files.copy(filePath, Paths.get(archivePath), StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
Files.copy(filePath, Paths.get(archivePath), StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// clean up the ingest directory once we're done
|
||||
public void cleanupIngest(File[] sourceFiles) {
|
||||
for (File f : sourceFiles) {
|
||||
f.delete();
|
||||
}
|
||||
public void cleanupFile(File sourceFile) {
|
||||
sourceFile.delete();
|
||||
}
|
||||
|
||||
// returns the repository's path
|
||||
|
Reference in New Issue
Block a user