aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tool/src/import/mod.rs15
-rw-r--r--tool/src/main.rs9
2 files changed, 20 insertions, 4 deletions
diff --git a/tool/src/import/mod.rs b/tool/src/import/mod.rs
index fb42c4d..b4e03d6 100644
--- a/tool/src/import/mod.rs
+++ b/tool/src/import/mod.rs
@@ -15,7 +15,7 @@ use jellycommon::{
};
use jellymatroska::read::EbmlReader;
use jellyremuxer::import::import_metadata;
-use log::{info, warn};
+use log::{debug, info, warn};
use std::{
collections::BTreeMap,
fs::{remove_file, File},
@@ -37,11 +37,24 @@ pub(crate) fn import(action: Action, dry: bool) -> anyhow::Result<()> {
video,
ignore_metadata,
r#move,
+ skip_existing,
} => {
if std::env::current_dir().unwrap().file_name().unwrap() != "library" {
warn!("new command can only be used in the library directory; what you are doing right now probably wont work.")
}
+ if skip_existing {
+ if let Some(input) = &input {
+ let guessed_path = path.join(input.file_stem().unwrap_or(input.as_os_str()));
+ if guessed_path.exists() {
+ info!("guessed output ({guessed_path:?}) exists, skipping import");
+ return Ok(());
+ } else {
+ debug!("guessed output ({guessed_path:?}) missing");
+ }
+ }
+ }
+
let tmdb_kind = if series { "tv" } else { "movie" };
let tmdb_id = if let Some(id) = tmdb_id {
Some(id.parse().unwrap())
diff --git a/tool/src/main.rs b/tool/src/main.rs
index 47c9a53..3744560 100644
--- a/tool/src/main.rs
+++ b/tool/src/main.rs
@@ -59,18 +59,21 @@ enum Action {
/// Marks node as a video
#[arg(long)]
video: bool,
- /// Path to the media of the node, required for non-series
- #[arg(short, long)]
- input: Option<PathBuf>,
/// Marks node as a series
#[arg(short, long)]
series: bool,
+ /// Path to the media of the node, required for non-series
+ #[arg(short, long)]
+ input: Option<PathBuf>,
/// Ignore attachments (dont use them as cover)
#[arg(long)]
ignore_attachments: bool,
/// Ignore metadate (no title, description and tagline from input)
#[arg(long)]
ignore_metadata: bool,
+ /// Skip any action that appears to be run already.
+ #[arg(long)]
+ skip_existing: bool,
},
Migrate {
database: PathBuf,