ee4469b385
* Blank slate * Added gitignore * Updated gitignore * Added rust code * Added modules * Fixed build issues * rustfmt * Updated models * Added parsers module * Updated utilities module * Updated main.rs * Updated api_parser and song model * Updated icarus_action model * Updated structs in managers module * Updated main.rs * More changes * Saving changes * Added new struct and methods * More changes. Not functional yet * Changed name of the project * Removed cmake workflow * Adding rust workflow * Adding code to the syncers module * Cargo formatting * Continuing work * Adding code to the syncers module * Added dependencies * Adding more code to the syncers module * Added more code to the syncers module It's not 100 percent done yet, I'll work on other modules * Added more code to the managers module * Added code to request a token * Cargo formatting * Adding more code to multi target upload * Adding more multi-target upload code and formatted code * Added more multi-upload code * cargo fmt * Got uploading functional and cargo fmt-ing * Uploading multi target works, but is buggy Not all of the songs are being uploaded * Added single target upload * Single target upload is functional but need to revisit multi-target upload Multi-target upload is broken now. Needs to be revisited * Fixed multi target upload * Can now retrieve songs * Downloading functionality is working * Delete functionality is operational * Updated README * More cleanup * Added test
82 lines
1.7 KiB
Rust
82 lines
1.7 KiB
Rust
mod constants;
|
|
mod managers;
|
|
mod models;
|
|
mod parsers;
|
|
mod syncers;
|
|
mod utilities;
|
|
|
|
use std::env;
|
|
use std::process;
|
|
|
|
fn exit_program(code: i32) {
|
|
process::exit(code);
|
|
}
|
|
|
|
fn print_help() {
|
|
let msg: String = String::from(
|
|
r#"icd [Action] [flag]
|
|
|
|
Actions
|
|
download
|
|
upload-meta
|
|
retrieve
|
|
delete
|
|
|
|
Flags
|
|
Required for all actions
|
|
-u username
|
|
-p password
|
|
-h host
|
|
|
|
Required for upload with metadata
|
|
-s path of song
|
|
-t track number
|
|
-m metadata filepath
|
|
-ca coverart filepath
|
|
-scma directory where songs, metadata, and cover art exists and will be uploaded (Optional)
|
|
|
|
Required for download
|
|
-b song id
|
|
-d path to download song (Optional)
|
|
|
|
Required for retrieving records
|
|
-rt retrieve type (songs is only accepted)
|
|
|
|
Required for deleting a song
|
|
-D song id"#,
|
|
);
|
|
|
|
println!("{}", msg);
|
|
}
|
|
|
|
fn main() {
|
|
let args: Vec<String> = env::args().collect();
|
|
|
|
if args.len() == 1 {
|
|
print_help();
|
|
exit_program(-1);
|
|
}
|
|
|
|
let args_len = args.len() as i32;
|
|
|
|
println!("Argument count: {}", args_len);
|
|
|
|
let mut act_mgr = managers::action_managers::ActionManager {
|
|
action: String::new(),
|
|
flags: Vec::new(),
|
|
params: args,
|
|
param_count: args_len,
|
|
};
|
|
act_mgr.initialize();
|
|
|
|
let chosen_act = act_mgr.retrieve_icarus_action();
|
|
|
|
chosen_act.print_action_and_flags();
|
|
|
|
let mut cmt_mgr = managers::commit_manager::CommitManager {
|
|
ica_action: chosen_act,
|
|
};
|
|
|
|
cmt_mgr.commit_action();
|
|
}
|