From 2a26a6030e25127a3967dd5bccba1fb05d485ab1 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 17 Dec 2023 20:58:10 +0100 Subject: chapters --- tool/src/import/mod.rs | 11 +++++++---- tool/src/main.rs | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'tool') diff --git a/tool/src/import/mod.rs b/tool/src/import/mod.rs index b4e03d6..973629c 100644 --- a/tool/src/import/mod.rs +++ b/tool/src/import/mod.rs @@ -37,6 +37,7 @@ pub(crate) fn import(action: Action, dry: bool) -> anyhow::Result<()> { video, ignore_metadata, r#move, + title, skip_existing, } => { if std::env::current_dir().unwrap().file_name().unwrap() != "library" { @@ -131,10 +132,11 @@ pub(crate) fn import(action: Action, dry: bool) -> anyhow::Result<()> { }; } - let title = tmdb_details - .as_ref() - .map(|d| d.title.clone().or(d.name.clone())) - .flatten() + let title = title + .or(tmdb_details + .as_ref() + .map(|d| d.title.clone().or(d.name.clone())) + .flatten()) .or(file_meta.as_ref().map(|m| m.title.clone()).flatten()) .expect("no title detected"); @@ -272,6 +274,7 @@ pub(crate) fn import(action: Action, dry: bool) -> anyhow::Result<()> { kind, children: Vec::new(), media: file_meta.as_ref().map(|m| MediaInfo { + chapters: m.chapters.clone(), duration: m.duration, tracks: m.tracks.clone(), }), diff --git a/tool/src/main.rs b/tool/src/main.rs index 3744560..31e63b7 100644 --- a/tool/src/main.rs +++ b/tool/src/main.rs @@ -74,6 +74,9 @@ enum Action { /// Skip any action that appears to be run already. #[arg(long)] skip_existing: bool, + /// Sets the title + #[arg(long)] + title: Option, }, Migrate { database: PathBuf, -- cgit v1.2.3-70-g09d2