diff options
Diffstat (limited to 'tool')
-rw-r--r-- | tool/Cargo.toml | 16 | ||||
-rw-r--r-- | tool/src/add.rs | 68 |
2 files changed, 43 insertions, 41 deletions
diff --git a/tool/Cargo.toml b/tool/Cargo.toml index 7d3a0a5..1383ee6 100644 --- a/tool/Cargo.toml +++ b/tool/Cargo.toml @@ -10,19 +10,19 @@ jellyimport = { path = "../import" } jellyclient = { path = "../client" } log = { workspace = true } -env_logger = "0.11.5" -anyhow = "1.0.92" +env_logger = "0.11.6" +anyhow = "1.0.95" reqwest = { workspace = true } -indicatif = "0.17.8" +indicatif = "0.17.11" tokio = { workspace = true } -clap = { version = "4.5.20", features = ["derive"] } -clap_complete = "4.5.36" +clap = { version = "4.5.27", features = ["derive"] } +clap_complete = "4.5.43" -serde = { version = "1.0.214", features = ["derive"] } -serde_json = "1.0.132" +serde = { version = "1.0.217", features = ["derive"] } +serde_json = "1.0.138" serde_yaml = "0.9.34" bincode = { version = "2.0.0-rc.3", features = ["serde"] } base64 = "0.22.1" -rand = "0.8.5" +rand = "0.9.0" dialoguer = { version = "0.11.0", features = ["fuzzy-select"] } diff --git a/tool/src/add.rs b/tool/src/add.rs index 7b3861e..59342da 100644 --- a/tool/src/add.rs +++ b/tool/src/add.rs @@ -1,15 +1,14 @@ use crate::cli::Action; use anyhow::{anyhow, bail, Context}; -use dialoguer::{theme::ColorfulTheme, Confirm, FuzzySelect, Input, MultiSelect}; +use dialoguer::{theme::ColorfulTheme, FuzzySelect, Input, MultiSelect}; use jellybase::{CONF, SECRETS}; -use jellycommon::{ImportOptions, ImportSource, TraktKind}; +use jellycommon::TraktKind; use jellyimport::trakt::Trakt; use log::warn; use std::{ fmt::Display, path::{Path, PathBuf}, }; -use tokio::{fs::File, io::AsyncWriteExt}; pub async fn add(action: Action) -> anyhow::Result<()> { match action { @@ -122,39 +121,42 @@ pub async fn add(action: Action) -> anyhow::Result<()> { }) }); - let mut sources = Vec::new(); - sources.push(ImportSource::Trakt { - id: trakt_object.ids.trakt.unwrap(), - kind: trakt_kind, - }); - if let Some(media) = media { - sources.push(ImportSource::Media { - path: media, - ignore_metadata: true, - ignore_attachments: false, - ignore_chapters: false, - }) - } + // TODO + drop((id, library_path, trakt_kind)); - let impo = ImportOptions { id, sources }; + // let mut sources = Vec::new(); + // sources.push(ImportSource::Trakt { + // id: trakt_object.ids.trakt.unwrap(), + // kind: trakt_kind, + // }); + // if let Some(media) = media { + // sources.push(ImportSource::Media { + // path: media, + // ignore_metadata: true, + // ignore_attachments: false, + // ignore_chapters: false, + // }) + // } - let ypath = CONF - .library_path - .join(library_path) - .join(&impo.id) - .with_extension("yaml"); + // let impo = ImportOptions { id, sources }; - if Confirm::with_theme(&theme) - .with_prompt(format!("Write {:?}?", ypath)) - .default(true) - .interact() - .unwrap() - { - File::create(ypath) - .await? - .write_all(serde_yaml::to_string(&impo)?.as_bytes()) - .await?; - } + // let ypath = CONF + // .library_path + // .join(library_path) + // .join(&impo.id) + // .with_extension("yaml"); + + // if Confirm::with_theme(&theme) + // .with_prompt(format!("Write {:?}?", ypath)) + // .default(true) + // .interact() + // .unwrap() + // { + // File::create(ypath) + // .await? + // .write_all(serde_yaml::to_string(&impo)?.as_bytes()) + // .await?; + // } Ok(()) } |