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
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline failed

This commit is contained in:
2022-05-20 07:58:52 -04:00
parent fe29664a83
commit 5bc2acac1d
5 changed files with 110 additions and 57 deletions

View File

@ -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