Added functionality to clean up transcoded source files
This commit is contained in:
parent
b979850582
commit
32ffcdf202
@ -47,9 +47,9 @@ impl Repository {
|
|||||||
return ingest_files;
|
return ingest_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn archive_file(&self, file: String) {
|
pub fn archive_file(&self, file: &str) {
|
||||||
let ingest_file = Path::new(&self.ingest_dir).join(&file);
|
let ingest_file = Path::new(&self.ingest_dir).join(file);
|
||||||
let archive_file = Path::new(&self.archive_dir).join(&file);
|
let archive_file = Path::new(&self.archive_dir).join(file);
|
||||||
|
|
||||||
match fs::copy(&ingest_file, &archive_file) {
|
match fs::copy(&ingest_file, &archive_file) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
@ -61,6 +61,12 @@ impl Repository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn cleanup_file(&self, file: &str) {
|
||||||
|
let ingest_file = Path::new(&self.ingest_dir).join(file);
|
||||||
|
fs::remove_file(&ingest_file)
|
||||||
|
.expect("File deletion failed.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_directory(path: &str) {
|
fn create_directory(path: &str) {
|
||||||
|
@ -22,7 +22,13 @@ impl Transcoder {
|
|||||||
|
|
||||||
for i in ingest_files {
|
for i in ingest_files {
|
||||||
// copy the file to the archive
|
// copy the file to the archive
|
||||||
self.repository.archive_file(i);
|
self.repository.archive_file(&i);
|
||||||
|
|
||||||
|
// perform the video transcode
|
||||||
|
// TODO - self.transcode(i);
|
||||||
|
|
||||||
|
// remove the source file
|
||||||
|
self.repository.cleanup_file(&i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user