aboutsummaryrefslogtreecommitdiff
path: root/import/src/plugins
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-02-18 13:25:24 +0100
committermetamuffin <metamuffin@disroot.org>2026-02-18 13:25:24 +0100
commit45a485431df0638396f0175de59275b3b5538022 (patch)
tree4993b5b8b598d6de1036308d32b50d078fd0e365 /import/src/plugins
parent3bbedf5ab337d8c6d608ed0b24b9c656b0ee1004 (diff)
downloadjellything-45a485431df0638396f0175de59275b3b5538022.tar
jellything-45a485431df0638396f0175de59275b3b5538022.tar.bz2
jellything-45a485431df0638396f0175de59275b3b5538022.tar.zst
wide card; node visi; import children plugin
Diffstat (limited to 'import/src/plugins')
-rw-r--r--import/src/plugins/misc.rs34
1 files changed, 18 insertions, 16 deletions
diff --git a/import/src/plugins/misc.rs b/import/src/plugins/misc.rs
index 309e0b1..e71106a 100644
--- a/import/src/plugins/misc.rs
+++ b/import/src/plugins/misc.rs
@@ -11,7 +11,12 @@ use jellydb::RowNum;
use jellyremuxer::matroska::{AttachedFile, Segment};
use log::info;
use regex::Regex;
-use std::{fs::File, io::Read, path::Path, sync::LazyLock};
+use std::{
+ fs::{File, read_to_string},
+ io::Read,
+ path::Path,
+ sync::LazyLock,
+};
pub struct ImageFiles;
impl ImportPlugin for ImageFiles {
@@ -141,21 +146,18 @@ impl ImportPlugin for Children {
}
}
fn file(&self, ct: &PluginContext, parent: RowNum, path: &Path) -> Result<()> {
- // TODO use idents
- // let filename = path.file_name().unwrap().to_string_lossy();
- // if filename.as_ref() == "children" {
- // info!("import children at {path:?}");
- // for line in read_to_string(path)?.lines() {
- // let line = line.trim();
- // if line.starts_with("#") || line.is_empty() {
- // continue;
- // }
- // ct.db.update_node_init(NodeID::from_slug(line), |n| {
- // n.slug = line.to_owned();
- // n.parents.insert(parent);
- // })?;
- // }
- // }
+ let filename = path.file_name().unwrap().to_string_lossy();
+ if filename.as_ref() == "children" {
+ info!("import children at {path:?}");
+ for line in read_to_string(path)?.lines() {
+ let line = line.trim();
+ if line.starts_with("#") || line.is_empty() {
+ continue;
+ }
+ ct.ic
+ .update_node_slug(line, |n| n.as_object().insert(NO_PARENT, parent))?;
+ }
+ }
Ok(())
}
}