aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-24 14:19:51 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-24 14:19:51 +0100
commit620a6af0a247ed1675477b86f77c07c55d9feea3 (patch)
tree51237711807f418dd5d3fa36a3ebe996e2dc6c37
parentb48a78da3717452716d85a4114b2322332f20d44 (diff)
downloadjellything-620a6af0a247ed1675477b86f77c07c55d9feea3.tar
jellything-620a6af0a247ed1675477b86f77c07c55d9feea3.tar.bz2
jellything-620a6af0a247ed1675477b86f77c07c55d9feea3.tar.zst
recursive media import ignores by extension
-rw-r--r--import/src/lib.rs56
1 files changed, 30 insertions, 26 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs
index 678d065..d1605fe 100644
--- a/import/src/lib.rs
+++ b/import/src/lib.rs
@@ -400,33 +400,37 @@ async fn process_source(
for f in media_path.read_dir()? {
let f = f?;
let child_path = f.path();
- let inf_id = infer_id_from_path(&child_path).context("inferring child id")?;
-
- if &inf_id == "archive" {
- continue;
- }
- process_source(
- inf_id.clone(),
- ImportSource::Media {
- location: match &location {
- AssetLocation::Media(p) => {
- AssetLocation::Media(p.join(f.file_name()))
- }
- _ => bail!("non media path media"),
+ if child_path.is_dir()
+ || matches!(
+ child_path.extension().map(|o| o.to_str().unwrap()),
+ Some("mks" | "mka" | "mkv" | "webm")
+ )
+ {
+ let inf_id =
+ infer_id_from_path(&child_path).context("inferring child id")?;
+ process_source(
+ inf_id.clone(),
+ ImportSource::Media {
+ location: match &location {
+ AssetLocation::Media(p) => {
+ AssetLocation::Media(p.join(f.file_name()))
+ }
+ _ => bail!("non media path media"),
+ },
+ ignore_attachments,
+ ignore_chapters,
+ ignore_metadata,
},
- ignore_attachments,
- ignore_chapters,
- ignore_metadata,
- },
- path,
- index_path,
- db,
- fed,
- ap,
- )
- .await
- .context(anyhow!("recursive media import: {:?}", f.path()))?;
- node.public.children.push(inf_id);
+ path,
+ index_path,
+ db,
+ fed,
+ ap,
+ )
+ .await
+ .context(anyhow!("recursive media import: {:?}", f.path()))?;
+ node.public.children.push(inf_id);
+ }
}
insert_node(&id, node)?;
} else if media_path.is_file() {