diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-17 15:54:09 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-17 15:54:09 +0100 |
| commit | b03dd6f20aa3a8ae9c0347b3a34d8b581182ff68 (patch) | |
| tree | 9e6cec11163cfc34efdfec534a983e67b9a9c331 /import/src | |
| parent | 6719d6e187c5da06ffff8b7eff10151c7855a935 (diff) | |
| download | jellything-b03dd6f20aa3a8ae9c0347b3a34d8b581182ff68.tar jellything-b03dd6f20aa3a8ae9c0347b3a34d8b581182ff68.tar.bz2 jellything-b03dd6f20aa3a8ae9c0347b3a34d8b581182ff68.tar.zst | |
improve db import debug; fix inverted mtime check
Diffstat (limited to 'import/src')
| -rw-r--r-- | import/src/lib.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs index 7980451..da72232 100644 --- a/import/src/lib.rs +++ b/import/src/lib.rs @@ -15,6 +15,7 @@ use crate::{ use anyhow::{Context, Result, anyhow}; use jellycache::{Cache, HashKey}; use jellycommon::{ + internal::{IM_MTIME, IM_PATH}, jellyobject::{self, ObjectBuffer, Path as TagPath, fields}, *, }; @@ -76,11 +77,6 @@ pub struct ImportConfig { pub db: Arc<dyn Database>, } -fields! { - IM_PATH: &str = 0x11001 "path"; - IM_MTIME: u64 = 0x11002 "mtime"; -} - fn node_slug_query(slug: &str) -> Query { Query { filter: Filter::Match(jellyobject::Path(vec![NO_SLUG.0]), slug.as_bytes().to_vec()), @@ -265,7 +261,7 @@ fn import_traverse( && let Some(parent) = parent { if incremental { - if compare_mtime(ic, path)? { + if !compare_mtime(ic, path)? { return Ok(()); } } @@ -439,7 +435,7 @@ fn compare_mtime(dba: &ImportConfig, path: &Path) -> Result<bool> { match txn.query_single(Query { filter: Filter::Match( TagPath(vec![IM_PATH.0]), - path.as_os_str().as_encoded_bytes().to_vec(), + path.to_string_lossy().as_bytes().to_vec(), ), sort: Sort::None, })? { @@ -462,14 +458,14 @@ fn update_mtime(dba: &ImportConfig, path: &Path) -> Result<()> { let row = match txn.query_single(Query { filter: Filter::Match( TagPath(vec![IM_PATH.0]), - path.as_os_str().as_encoded_bytes().to_vec(), + path.to_string_lossy().as_bytes().to_vec(), ), sort: Sort::None, })? { Some(row) => row, None => txn.insert(ObjectBuffer::new(&mut [( IM_PATH.0, - &path.as_os_str().as_encoded_bytes(), + &path.to_string_lossy().as_bytes(), )]))?, }; |