diff options
author | metamuffin <metamuffin@disroot.org> | 2023-12-21 23:57:42 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-12-21 23:57:42 +0100 |
commit | 3a29113e965a94bdef06655f1583cc6e86edd606 (patch) | |
tree | a0910fa9687a9935ba1ca85a9cb5def1a0bc9069 /tool/src/main.rs | |
parent | a8b2480e898e269e7e0d41dbd46d9a18c7d1e4ba (diff) | |
download | jellything-3a29113e965a94bdef06655f1583cc6e86edd606.tar jellything-3a29113e965a94bdef06655f1583cc6e86edd606.tar.bz2 jellything-3a29113e965a94bdef06655f1583cc6e86edd606.tar.zst |
rework import system pt. 1
Diffstat (limited to 'tool/src/main.rs')
-rw-r--r-- | tool/src/main.rs | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/tool/src/main.rs b/tool/src/main.rs index 31e63b7..34337ce 100644 --- a/tool/src/main.rs +++ b/tool/src/main.rs @@ -5,12 +5,10 @@ */ #![feature(file_create_new)] -pub mod import; pub mod migrate; use base64::Engine; use clap::{Parser, Subcommand, ValueEnum}; -use import::import; use jellyclient::{Instance, LoginDetails}; use jellycommon::{config::GlobalConfig, Node, NodeKind, NodePrivate, NodePublic}; use log::{info, warn}; @@ -37,47 +35,47 @@ enum Action { #[arg(short, long)] hostname: String, }, - /// Imports a movie, video or series given media and metadata sources - New { - /// Relative path to the node's parent(!). - path: PathBuf, - /// Search the node by title on TMDB - #[arg(short = 't', long)] - tmdb_search: Option<String>, - /// Search the node by id on TMDB - #[arg(short = 'T', long)] - tmdb_id: Option<String>, - #[arg(long)] - /// Prefix the inferred id with something to avoid collisions - ident_prefix: Option<String>, - /// Copies media into the library - #[arg(long)] - copy: bool, - /// Moves media into the library (potentially destructive operation) - #[arg(long)] - r#move: bool, - /// Marks node as a video - #[arg(long)] - video: bool, - /// 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, - /// Sets the title - #[arg(long)] - title: Option<String>, - }, + // /// Imports a movie, video or series given media and metadata sources + // New { + // /// Relative path to the node's parent(!). + // path: PathBuf, + // /// Search the node by title on TMDB + // #[arg(short = 't', long)] + // tmdb_search: Option<String>, + // /// Search the node by id on TMDB + // #[arg(short = 'T', long)] + // tmdb_id: Option<String>, + // #[arg(long)] + // /// Prefix the inferred id with something to avoid collisions + // ident_prefix: Option<String>, + // /// Copies media into the library + // #[arg(long)] + // copy: bool, + // /// Moves media into the library (potentially destructive operation) + // #[arg(long)] + // r#move: bool, + // /// Marks node as a video + // #[arg(long)] + // video: bool, + // /// 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, + // /// Sets the title + // #[arg(long)] + // title: Option<String>, + // }, Migrate { database: PathBuf, mode: MigrateMode, @@ -118,8 +116,11 @@ fn main() -> anyhow::Result<()> { std::fs::create_dir_all(path.join("library"))?; std::fs::create_dir_all(path.join("cache"))?; std::fs::create_dir_all(path.join("assets"))?; + std::fs::create_dir_all(path.join("media"))?; File::create_new(path.join("assets/front.htm"))? .write_fmt(format_args!("<h1>My very own jellything instance</h1>"))?; + + // TODO: dont fill that serde_yaml::to_writer( File::create_new(path.join("config.yaml"))?, &GlobalConfig { @@ -149,8 +150,8 @@ fn main() -> anyhow::Result<()> { File::create_new(path.join("library/directory.json"))?, &Node { public: NodePublic { - kind: NodeKind::Collection, - title: "My Library".to_string(), + kind: Some(NodeKind::Collection), + title: Some("My Library".to_string()), ..Default::default() }, private: NodePrivate { @@ -162,7 +163,7 @@ fn main() -> anyhow::Result<()> { warn!("please change the admin password."); Ok(()) } - a @ Action::New { .. } => import(a, args.dry), + // a @ Action::New { .. } => import(a, args.dry), a @ Action::Migrate { .. } => migrate(a), Action::Reimport { config, |