aboutsummaryrefslogtreecommitdiff
path: root/tool/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-29 16:07:58 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-29 16:07:58 +0100
commite7ba3274e27fad755f15465581f5b403c82ab4d2 (patch)
treef2d693c61786ee6ed027636393fd75f086bd77e8 /tool/src
parent5ac3f397b4a28b7bf8b399e73ad0d29e3da45ab0 (diff)
downloadjellything-e7ba3274e27fad755f15465581f5b403c82ab4d2.tar
jellything-e7ba3274e27fad755f15465581f5b403c82ab4d2.tar.bz2
jellything-e7ba3274e27fad755f15465581f5b403c82ab4d2.tar.zst
prepare database refactor
Diffstat (limited to 'tool/src')
-rw-r--r--tool/src/add.rs68
1 files changed, 35 insertions, 33 deletions
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(())
}