From 23771784927214cb82615f6bd745d294cea6a6f0 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 7 Apr 2024 22:41:46 -0400 Subject: [PATCH] Fixed build issues --- Cargo.toml | 3 +++ src/main.rs | 17 ++++++++--------- src/managers/action_managers.rs | 18 ++++++++++-------- src/managers/commit_manager.rs | 26 ++++++++++++++------------ src/managers/mod.rs | 3 +++ src/managers/user_manager.rs | 14 ++++++++------ src/models/api.rs | 4 ++-- src/models/flags.rs | 4 ++-- src/models/icarus_action.rs | 8 +++++--- src/models/mod.rs | 7 +++++++ src/models/song.rs | 6 +++--- src/models/token.rs | 4 ++-- src/models/upload_form.rs | 4 ++-- src/models/user.rs | 17 ++++++++--------- src/parsers/mod.rs | 1 + src/syncers/mod.rs | 5 +++++ src/utilities/checks.rs | 4 ++-- src/utilities/conversions.rs | 4 ++-- src/utilities/mod.rs | 2 ++ 19 files changed, 89 insertions(+), 62 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 13088dc..ef2d8a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,9 @@ name = "IcarusDownloadManager" version = "0.1.0" edition = "2021" + + + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/src/main.rs b/src/main.rs index 459620a..46efc53 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,11 +4,6 @@ mod models; use std::env; use std::process; -// use managers::{ActionManager}; -use crate::src::managers::{ActionManager, CommitManager}; -// use models::{user, upload_form}; - -// use models:: fn exit_program(code: i32) { @@ -65,19 +60,23 @@ fn main() { exit_program(-1); } - let act_mgr = ActionManager { - // let act_mgr = crate::src::managers::ActionManager { + let act_mgr = managers::action_managers::ActionManager { action: String::from(""), flags: Vec::new(), params: args, - param_count: args.len(), + param_count: 2, }; let chosen_act = act_mgr.retrieve_icarus_action(); chosen_act.print_action_and_flags(); - let cmt_mgr = CommitManager { + let cmt_mgr = managers::commit_manager::CommitManager { + action: String::from(""), + flags: Vec::new(), + params: Vec::new(), + param_count: 1, + ica_action: chosen_act, }; cmt_mgr.commit_action(); diff --git a/src/managers/action_managers.rs b/src/managers/action_managers.rs index 6651d9b..b4029a8 100644 --- a/src/managers/action_managers.rs +++ b/src/managers/action_managers.rs @@ -1,19 +1,21 @@ use serde::{Deserialize, Serialize}; -mod managers { +use crate::models; + +// mod managers { #[derive(Debug, Deserialize, Serialize)] pub struct ActionManager { - action: String, - flags: Vec, - params: Vec, - param_count: i32, + pub action: String, + pub flags: Vec, + pub params: Vec, + pub param_count: i32, } impl ActionManager { // TODO: Implement - pub fn retrieve_icarus_action(&self) -> models::IcarusAction { - return models::IcarusAction { + pub fn retrieve_icarus_action(&self) -> models::icarus_action::IcarusAction { + return models::icarus_action::IcarusAction { action: String::from(""), flags: Vec::new(), }; @@ -52,4 +54,4 @@ impl ActionManager { return Vec::new(); } } -} +// } diff --git a/src/managers/commit_manager.rs b/src/managers/commit_manager.rs index 45ce9e7..12dfa8a 100644 --- a/src/managers/commit_manager.rs +++ b/src/managers/commit_manager.rs @@ -2,15 +2,17 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; -mod managers { +use crate::models; + +// mod managers { #[derive(Debug, Deserialize, Serialize)] pub struct CommitManager { - action: String, - flags: Vec, - params: Vec, - param_count: i32, - ica_action: models::IcarusAction, + pub action: String, + pub flags: Vec, + pub params: Vec, + pub param_count: i32, + pub ica_action: models::icarus_action::IcarusAction, } pub struct Album { @@ -20,7 +22,7 @@ pub struct Album { pub year: i32, pub track_count: i32, pub disc_count: i32, - pub songs: Vec, + pub songs: Vec, } @@ -53,7 +55,7 @@ impl CommitManager { } // TODO: Implement - fn parse_token(&self, api: &models::API) { + fn parse_token(&self, api: &models::api::API) { } // TODO: Implement fn upload_song_with_metadata(&self) { @@ -66,17 +68,17 @@ impl CommitManager { fn multi_target_upload(&self, sourcepath: &String) { } // TODO: Implement - fn initialize_disc_and_track(&self, song: &Song) { + fn initialize_disc_and_track(&self, song: &models::song::Song) { } // TODO: Implement - fn parse_disc_and_track(&self, song: &Song, track_id: &String) { + fn parse_disc_and_track(&self, song: &models::song::Song, track_id: &String) { } // TODO: Implement fn check_for_no_confirm(&self) -> bool { return false; } // TODO: Implement - fn retrieve_metadata(&self, path: &String) -> models::Album { + fn retrieve_metadata(&self, path: &String) -> Album { return Album { title: String::from(""), album_artist: String::from(""), @@ -92,4 +94,4 @@ impl CommitManager { return String::from(""); } } -} +// } diff --git a/src/managers/mod.rs b/src/managers/mod.rs index e69de29..33e3254 100644 --- a/src/managers/mod.rs +++ b/src/managers/mod.rs @@ -0,0 +1,3 @@ +pub mod action_managers; +pub mod commit_manager; +pub mod user_manager; \ No newline at end of file diff --git a/src/managers/user_manager.rs b/src/managers/user_manager.rs index 71fb827..bd81d31 100644 --- a/src/managers/user_manager.rs +++ b/src/managers/user_manager.rs @@ -1,17 +1,19 @@ use serde::{Deserialize, Serialize}; -mod managers { +use crate::models; + +// mod managers { #[derive(Debug, Deserialize, Serialize)] pub struct UserManager { - user: models::User, - ica_action: models::IcarusAction, + user: models::user::User, + ica_action: models::icarus_action::IcarusAction, } impl UserManager { // TODO: Implement - pub fn retrieve_user(&self) -> models::User { - return models::User { + pub fn retrieve_user(&self) -> models::user::User { + return models::user::User { username: String::from(""), password: String::from(""), }; @@ -21,4 +23,4 @@ impl UserManager { fn parse_user_from_actions(&self) { } } -} +// } diff --git a/src/models/api.rs b/src/models/api.rs index c770b20..49fe1eb 100644 --- a/src/models/api.rs +++ b/src/models/api.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -mod models { +// mod models { #[derive(Debug, Deserialize, Serialize)] pub struct API { @@ -8,4 +8,4 @@ pub struct API { pub endpoint: String, pub version: String, } -} +// } diff --git a/src/models/flags.rs b/src/models/flags.rs index 5090ed6..ee07178 100644 --- a/src/models/flags.rs +++ b/src/models/flags.rs @@ -1,9 +1,9 @@ use serde::{Deserialize, Serialize}; -mod models { +// mod models { #[derive(Debug, Deserialize, Serialize)] pub struct Flags { pub flag: String, pub value: String, } -} +// } diff --git a/src/models/icarus_action.rs b/src/models/icarus_action.rs index 73896b8..d246f43 100644 --- a/src/models/icarus_action.rs +++ b/src/models/icarus_action.rs @@ -1,11 +1,13 @@ use serde::{Deserialize, Serialize}; -mod models { +use crate::models; + +// mod models { #[derive(Debug, Deserialize, Serialize)] pub struct IcarusAction { pub action: String, - pub flags: Vec, + pub flags: Vec, } impl IcarusAction { @@ -18,4 +20,4 @@ impl IcarusAction { pub fn print_action_and_flags(&self) { } } -} +// } diff --git a/src/models/mod.rs b/src/models/mod.rs index e69de29..5da7165 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -0,0 +1,7 @@ +pub mod api; +pub mod flags; +pub mod icarus_action; +pub mod song; +pub mod token; +pub mod upload_form; +pub mod user; \ No newline at end of file diff --git a/src/models/song.rs b/src/models/song.rs index 95b268f..08b49d0 100644 --- a/src/models/song.rs +++ b/src/models/song.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -mod models { +// mod models { #[derive(Debug, Deserialize, Serialize)] pub struct Song { @@ -9,7 +9,7 @@ pub struct Song { pub artist: String, pub album: String, pub genre: String, - pub year: int, + pub year: i32, pub duration: f64, pub track: i32, pub disc: i32, @@ -48,4 +48,4 @@ pub struct CoverArt { pub title: String, pub path: String, } -} \ No newline at end of file +// } \ No newline at end of file diff --git a/src/models/token.rs b/src/models/token.rs index 53bca7f..07fbe6b 100644 --- a/src/models/token.rs +++ b/src/models/token.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -mod models { +// mod models { #[derive(Debug, Deserialize, Serialize)] pub struct Token { @@ -8,4 +8,4 @@ pub struct Token { pub token_type: String, pub expiration: i32, } -} +// } diff --git a/src/models/upload_form.rs b/src/models/upload_form.rs index 935b835..e7f4edc 100644 --- a/src/models/upload_form.rs +++ b/src/models/upload_form.rs @@ -1,10 +1,10 @@ use serde::{Deserialize, Serialize}; -mod models { +// mod models { #[derive(Debug, Deserialize, Serialize)] pub struct UploadForm { pub url: String, pub filepath: String, } -} \ No newline at end of file +// } \ No newline at end of file diff --git a/src/models/user.rs b/src/models/user.rs index 39a9f98..2790a96 100644 --- a/src/models/user.rs +++ b/src/models/user.rs @@ -1,10 +1,9 @@ -use serde::{Deserialize, Serialize}; +// mod models { + use serde::{Deserialize, Serialize}; -mod models { - -#[derive(Debug, Deserialize, Serialize)] -pub struct User { - pub username: String, - pub password: String, -} -} \ No newline at end of file + #[derive(Debug, Deserialize, Serialize)] + pub struct User { + pub username: String, + pub password: String, + } +// } \ No newline at end of file diff --git a/src/parsers/mod.rs b/src/parsers/mod.rs index e69de29..c5b5ef6 100644 --- a/src/parsers/mod.rs +++ b/src/parsers/mod.rs @@ -0,0 +1 @@ +pub mod api_parser; \ No newline at end of file diff --git a/src/syncers/mod.rs b/src/syncers/mod.rs index e69de29..5eddbb6 100644 --- a/src/syncers/mod.rs +++ b/src/syncers/mod.rs @@ -0,0 +1,5 @@ +pub mod delete; +pub mod download; +pub mod retrieve_records; +pub mod syncer_base; +pub mod upload; \ No newline at end of file diff --git a/src/utilities/checks.rs b/src/utilities/checks.rs index 1816d94..ace1ca7 100644 --- a/src/utilities/checks.rs +++ b/src/utilities/checks.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -mod utilities { +// mod utilities { #[derive(Debug, Deserialize, Serialize)] pub struct Checks { @@ -24,4 +24,4 @@ impl Checks { return String::from(""); } } -} +// } diff --git a/src/utilities/conversions.rs b/src/utilities/conversions.rs index 0d18b3f..822ac12 100644 --- a/src/utilities/conversions.rs +++ b/src/utilities/conversions.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -mod utilities { +// mod utilities { #[derive(Debug, Deserialize, Serialize)] pub struct Conversions { @@ -20,4 +20,4 @@ impl Conversions { } } -} \ No newline at end of file +// } \ No newline at end of file diff --git a/src/utilities/mod.rs b/src/utilities/mod.rs index e69de29..e7eb3d8 100644 --- a/src/utilities/mod.rs +++ b/src/utilities/mod.rs @@ -0,0 +1,2 @@ +pub mod checks; +pub mod conversions; \ No newline at end of file