fix: Fix COMPRESSION typo, correct DIGEST log tag, and refactor mode_update cloning
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
eaeb83f12e
commit
e7496b8978
@@ -97,7 +97,7 @@ pub trait CompressionEngine {
|
|||||||
loop {
|
loop {
|
||||||
let n = reader.read(&mut buffer[..libc::BUFSIZ as usize])?;
|
let n = reader.read(&mut buffer[..libc::BUFSIZ as usize])?;
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
debug!("COMPREESSION: EOF");
|
debug!("COMPRESSION: EOF");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ impl DigestEngine for DigestEngineProgram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_program_path(program: &str) -> Result<String> {
|
fn get_program_path(program: &str) -> Result<String> {
|
||||||
debug!("COMPRESSION: Looking for executable: {}", program);
|
debug!("DIGEST: Looking for executable: {}", program);
|
||||||
if let Ok(path) = env::var("PATH") {
|
if let Ok(path) = env::var("PATH") {
|
||||||
for p in path.split(':') {
|
for p in path.split(':') {
|
||||||
let p_str = format!("{}/{}", p, program);
|
let p_str = format!("{}/{}", p, program);
|
||||||
|
|||||||
@@ -39,18 +39,16 @@ pub fn mode_update(
|
|||||||
db::set_item_tags(conn, item.clone(), tags)?;
|
db::set_item_tags(conn, item.clone(), tags)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let item_path = {
|
||||||
|
let mut path = data_path.clone();
|
||||||
|
path.push(item.id.unwrap().to_string());
|
||||||
|
path
|
||||||
|
};
|
||||||
|
|
||||||
if item.size.is_none() {
|
if item.size.is_none() {
|
||||||
info!("Updating unknown stream size");
|
info!("Updating unknown stream size");
|
||||||
let item_path = {
|
|
||||||
let mut path = data_path.clone();
|
|
||||||
path.push(item.id.unwrap().to_string());
|
|
||||||
path
|
|
||||||
};
|
|
||||||
let item_file_metadata = item_path.metadata();
|
let item_file_metadata = item_path.metadata();
|
||||||
|
|
||||||
// Ensure item_path is in scope for later use
|
|
||||||
let item_path_clone = item_path.clone();
|
|
||||||
|
|
||||||
if item_file_metadata.is_ok() {
|
if item_file_metadata.is_ok() {
|
||||||
debug!("MAIN: Updating stream size of {:?}", item_path);
|
debug!("MAIN: Updating stream size of {:?}", item_path);
|
||||||
let compression_type = CompressionType::from_str(&item.compression)?;
|
let compression_type = CompressionType::from_str(&item.compression)?;
|
||||||
@@ -80,7 +78,7 @@ pub fn mode_update(
|
|||||||
let compression_engine = get_compression_engine(compression_type)
|
let compression_engine = get_compression_engine(compression_type)
|
||||||
.expect("Unable to get compression engine");
|
.expect("Unable to get compression engine");
|
||||||
|
|
||||||
let mut reader = compression_engine.open(item_path_clone)?;
|
let mut reader = compression_engine.open(item_path.clone())?;
|
||||||
let mut buffer = [0; 4096];
|
let mut buffer = [0; 4096];
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
Reference in New Issue
Block a user