aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-08-04 23:20:21 +0200
committermetamuffin <metamuffin@disroot.org>2023-08-04 23:20:21 +0200
commit2345469bc56f5daba8ced77e49ad58f38b1c5538 (patch)
treef54a61177580ffc49e7903ccab12cf7cc5354833
parent0a2f1d909aed3c807a30589aeca17f81c694dd37 (diff)
downloadjellything-2345469bc56f5daba8ced77e49ad58f38b1c5538.tar
jellything-2345469bc56f5daba8ced77e49ad58f38b1c5538.tar.bz2
jellything-2345469bc56f5daba8ced77e49ad58f38b1c5538.tar.zst
fixes, set parent node correctly
-rw-r--r--import/src/infojson.rs6
-rw-r--r--import/src/main.rs1
-rw-r--r--server/src/import.rs8
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<bool>,
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<String>,
pub ext: String, //"vtt" | "json3" | "srv1" | "srv2" | "srv3" | "ttml",
pub protocol: Option<String>,
pub name: Option<String>,
@@ -74,7 +74,7 @@ pub struct YFormat {
pub protocol: String,
pub acodec: Option<String>,
pub vcodec: Option<String>,
- pub url: String,
+ pub url: Option<String>,
pub width: Option<u32>,
pub height: Option<u32>,
pub fps: Option<f64>,
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