From 2345469bc56f5daba8ced77e49ad58f38b1c5538 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 4 Aug 2023 23:20:21 +0200 Subject: fixes, set parent node correctly --- import/src/infojson.rs | 6 +++--- import/src/main.rs | 1 - server/src/import.rs | 8 +++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/import/src/infojson.rs b/import/src/infojson.rs index d9d60ed..e22fd71 100644 --- a/import/src/infojson.rs +++ b/import/src/infojson.rs @@ -31,7 +31,7 @@ pub struct YVideo { pub like_count: usize, pub channel: String, pub channel_follower_count: usize, - pub channel_is_verified: bool, + pub channel_is_verified: Option, pub uploader: String, pub uploader_id: String, pub uploader_url: String, @@ -60,7 +60,7 @@ pub struct YVideo { #[derive(Debug, Serialize, Deserialize)] pub struct YCaption { - pub url: String, + pub url: Option, pub ext: String, //"vtt" | "json3" | "srv1" | "srv2" | "srv3" | "ttml", pub protocol: Option, pub name: Option, @@ -74,7 +74,7 @@ pub struct YFormat { pub protocol: String, pub acodec: Option, pub vcodec: Option, - pub url: String, + pub url: Option, pub width: Option, pub height: Option, pub fps: Option, diff --git a/import/src/main.rs b/import/src/main.rs index 29d1e21..b55b645 100644 --- a/import/src/main.rs +++ b/import/src/main.rs @@ -275,7 +275,6 @@ fn main() -> anyhow::Result<()> { }; if args.dry { - println!("{}", serde_json::to_string_pretty(&infojson)?); println!("{}", serde_json::to_string_pretty(&node)?); } else { if let Some(source_path) = source_path { diff --git a/server/src/import.rs b/server/src/import.rs index 374c2c7..3b45f14 100644 --- a/server/src/import.rs +++ b/server/src/import.rs @@ -55,7 +55,13 @@ pub async fn import_path( None } }); - let identifier = path.file_name().unwrap().to_str().unwrap().to_string(); + let identifier = if mpath.exists() { + path.file_name().unwrap().to_str().unwrap().to_string() + } else { + parent + .clone() + .ok_or(anyhow!("non-root node requires parent"))? + }; let all = join_all( children_paths -- cgit v1.2.3-70-g09d2