diff options
Diffstat (limited to 'import/src/lib.rs')
| -rw-r--r-- | import/src/lib.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs index 763af42..0f61c48 100644 --- a/import/src/lib.rs +++ b/import/src/lib.rs @@ -112,12 +112,14 @@ fn import(db: &Database, incremental: bool) -> Result<()> { let rt = Handle::current(); files.into_par_iter().for_each(|(path, parent, iflags)| { + reporting::set_task(format!("unknown: {path:?}")); import_file(db, &rt, &plugins, &path, parent, iflags); IMPORT_PROGRESS .blocking_write() .as_mut() .unwrap() .finished_items += 1; + reporting::set_task("idle".to_owned()); }); Ok(()) @@ -234,9 +236,7 @@ fn import_file( } } } - } - - if filename.ends_with("mkv") || filename.ends_with("mka") || filename.ends_with("mks") { + } else if filename.ends_with("mkv") || filename.ends_with("mka") || filename.ends_with("mks") { let slug = get_node_slug(path).unwrap(); let node = NodeID::from_slug(&slug); @@ -250,6 +250,7 @@ fn import_file( })) .is_some(); + reporting::set_task(format!("demuxer meta: {path:?}")); let Some(seg) = reporting::catch(read_media_metadata(path).context(anyhow!("media {path:?}"))) else { @@ -266,7 +267,18 @@ fn import_file( .is_some(); } } - reporting::set_task("idle".to_owned()); + } else { + for p in plugins { + let inf = p.info(); + if inf.handle_file { + reporting::set_task(format!("{}(file): {path:?}", inf.name)); + all_ok &= reporting::catch( + p.file(&ImportContext { db, rt, iflags }, parent, path) + .context(anyhow!("{}(file) {path:?}", inf.name)), + ) + .is_some(); + } + } } if all_ok { |