Download song #65
Generated
+1
-1
@@ -479,7 +479,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icarus-dm"
|
||||
version = "0.6.2"
|
||||
version = "0.6.6"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"http",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "icarus-dm"
|
||||
version = "0.6.2"
|
||||
version = "0.6.6"
|
||||
rust-version = "1.88"
|
||||
edition = "2024"
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ The program has been built and can be executed by the binary file *icarus-dm*. F
|
||||
### Downloading Song
|
||||
|
||||
```BASH
|
||||
icarus-dm download -u spacecadet -p stellar40 -h https://icarus.com -b e8407fc6-edd2-44c1-993f-08dd7324d91a
|
||||
icarus-dm download -u spacecadet -p stellar40 -h https://icarus.com -ha https://auth.icarus.com -b e8407fc6-edd2-44c1-993f-08dd7324d91a
|
||||
```
|
||||
|
||||
### Uploading Song with metadata
|
||||
|
||||
+2
-1
@@ -12,7 +12,8 @@ pub fn print_help() {
|
||||
Required for all actions
|
||||
-u username
|
||||
-p password
|
||||
-h host
|
||||
-h api host
|
||||
-ha auth api host
|
||||
|
||||
Required for upload with metadata
|
||||
-s path of song
|
||||
|
||||
@@ -196,6 +196,7 @@ impl CommitManager {
|
||||
let auth_api = prsr.retrieve_api(parsers::api_parser::APIType::Auth);
|
||||
let token = self.parse_token(&auth_api).await;
|
||||
println!("Message: {}", token.message);
|
||||
|
||||
let api = prsr.retrieve_api(parsers::api_parser::APIType::Main);
|
||||
|
||||
let mut dwn_loader = syncers::download::Download { api: api.clone() };
|
||||
@@ -203,8 +204,8 @@ impl CommitManager {
|
||||
id: song_id,
|
||||
..Default::default()
|
||||
};
|
||||
let result_fut = dwn_loader.download_song(&token, &song);
|
||||
match Runtime::new().unwrap().block_on(result_fut) {
|
||||
|
||||
match dwn_loader.download_song(&token, &song).await {
|
||||
Ok(o) => {
|
||||
println!("Success");
|
||||
let filename = String::from("audio")
|
||||
|
||||
@@ -15,7 +15,7 @@ fn retrieve_url_reg(api: &models::api::Api) -> String {
|
||||
}
|
||||
|
||||
fn retrieve_url_with_id(api: &models::api::Api, id: &uuid::Uuid) -> String {
|
||||
let url = format!("{}/api/{}/{}/{}", api.url, api.version, api.endpoint, id);
|
||||
let url = format!("{}api/{}/{}/{}", api.url, api.version, api.endpoint, id);
|
||||
|
||||
url
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ impl Download {
|
||||
token: &icarus_models::token::AccessToken,
|
||||
song: &icarus_models::song::Song,
|
||||
) -> Result<String, MyError> {
|
||||
self.api.endpoint = String::from("song/data/download");
|
||||
self.api.endpoint = String::from("song/download");
|
||||
let url = syncers::common::retrieve_url(&self.api, true, &song.id);
|
||||
let access_token = token.bearer_token();
|
||||
|
||||
@@ -35,13 +35,10 @@ impl Download {
|
||||
.await
|
||||
{
|
||||
Ok(rep) => match rep.status() {
|
||||
reqwest::StatusCode::OK => {
|
||||
let data = rep.text();
|
||||
match data.await {
|
||||
Ok(e) => Ok(e),
|
||||
Err(er) => Err(MyError::Other(er.to_string())),
|
||||
}
|
||||
}
|
||||
reqwest::StatusCode::OK => match rep.text().await {
|
||||
Ok(e) => Ok(e),
|
||||
Err(er) => Err(MyError::Other(er.to_string())),
|
||||
},
|
||||
reqwest::StatusCode::UNAUTHORIZED => {
|
||||
Err(MyError::Other(String::from("Need to grab a new token")))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user