1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
use crate::{files::get_downloaded_versions, db::{userlist_get_all_applicable_versions_with_mods, userlist_get_all_current_versions_with_mods}};
#[allow(unused_imports)]
use crate::{List, get_current_list, config::Cfg, db::userlist_get_all_downloads, input::Input};
pub async fn download(config: Cfg, _input: Input) -> Result<(), Box<dyn std::error::Error>> {
let current_list = get_current_list(config.clone())?;
println!("NO IMPLEMENTATION FOR DOWNLOAD YET");
let downloaded_versions = get_downloaded_versions(current_list.clone())?;
println!("DL: {:?}", downloaded_versions);
let current_version_ids = userlist_get_all_current_versions_with_mods(config.clone(), String::from(¤t_list.id))?;
println!("CU: {:?}", current_version_ids);
let applicable_version_ids = userlist_get_all_applicable_versions_with_mods(config, current_list.id)?;
println!("AP: {:?}", applicable_version_ids);
/*
let list = get_current_list(config.clone())?;
let links = userlist_get_all_downloads(config.clone(), list.clone().id)?;
download_links(config, input, list, links).await?;
*/
Ok(())
}
#[allow(dead_code)]
async fn download_links(_config: Cfg, _input: Input, _current_list: List, _links: Vec<String>) -> Result<String, Box<dyn std::error::Error>> {
println!("NO DL IMPLEMENTATION FOR DOWNLOAD YET");
//TODO copy dl from update if possible
/*
let dl_path = String::from(¤t_list.download_folder);
if input.clean {
let dl_path = ¤t_list.download_folder;
println!("Cleaning {}", dl_path);
for entry in std::fs::read_dir(dl_path)? {
let entry = entry?;
std::fs::remove_file(entry.path())?;
}
}
*/
Ok(String::new())
}
|