Multi upload (#64)
* Added comments * Added TODO * Got it working * Updated documentation * Version bump * Code formatting and cleanup
This commit was merged in pull request #64.
This commit is contained in:
Generated
+1
-1
@@ -479,7 +479,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icarus-dm"
|
name = "icarus-dm"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"http",
|
"http",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "icarus-dm"
|
name = "icarus-dm"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
rust-version = "1.88"
|
rust-version = "1.88"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ icarus-dm download -u spacecadet -p stellar40 -h https://icarus.com -b e8407fc6-
|
|||||||
### Uploading Song with metadata
|
### Uploading Song with metadata
|
||||||
|
|
||||||
```BASH
|
```BASH
|
||||||
icarus-dm upload-meta -u spacecadet -p stellar40 -h https://icarus.com -s /path/of/song.flac -t 1 -m /path/to/metadata/config/collection.json -ca /path/to/cover/art/image.png
|
icarus-dm upload-meta -u spacecadet -p stellar40 -h https://icarus.com -ha https://auth.icarus.com -s /path/of/song.flac -t 1 -m /path/to/metadata/config/collection.json -ca /path/to/cover/art/image.png
|
||||||
```
|
```
|
||||||
|
|
||||||
### Uploading Song with metadata from directory
|
### Uploading Song with metadata from directory
|
||||||
|
|
||||||
```BASH
|
```BASH
|
||||||
icarus-dm upload-meta -u spacecadet -p stellar40 -h https://icarus.com -smca /path/where/songs/and/metadata/exists/
|
icarus-dm upload-meta -u spacecadet -p stellar40 -h https://icarus.com -ha https://auth.icarus.com -smca /path/where/songs/and/metadata/exists/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Retrieving Song in json
|
### Retrieving Song in json
|
||||||
|
|||||||
@@ -332,6 +332,7 @@ impl CommitManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Only uploading one song
|
||||||
async fn sing_target_upload(
|
async fn sing_target_upload(
|
||||||
&mut self,
|
&mut self,
|
||||||
songpath: &String,
|
songpath: &String,
|
||||||
@@ -413,6 +414,7 @@ impl CommitManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Upload song to the queue to get processed
|
||||||
async fn upload_song_process(&self, data: &UploadSongMembers) -> Result<()> {
|
async fn upload_song_process(&self, data: &UploadSongMembers) -> Result<()> {
|
||||||
let mut up = syncers::upload::Upload::default();
|
let mut up = syncers::upload::Upload::default();
|
||||||
let host = self.ica_action.retrieve_flag_value(&String::from("-h"));
|
let host = self.ica_action.retrieve_flag_value(&String::from("-h"));
|
||||||
@@ -558,28 +560,40 @@ impl CommitManager {
|
|||||||
cover_art.data = cover_art.to_data().unwrap();
|
cover_art.data = cover_art.to_data().unwrap();
|
||||||
|
|
||||||
match self.get_songs(&metadatapath, sourcepath) {
|
match self.get_songs(&metadatapath, sourcepath) {
|
||||||
Ok(sngs) => {
|
Ok(sngs) => match icarus_models::album::collection::parse_album(&metadatapath) {
|
||||||
|
Ok(album) => {
|
||||||
for song in sngs {
|
for song in sngs {
|
||||||
match Runtime::new()
|
let members = UploadSongMembers {
|
||||||
.unwrap()
|
song: song,
|
||||||
.block_on(up.upload_song_with_metadata(&token, &song, &cover_art))
|
coverart: cover_art.clone(),
|
||||||
{
|
token: token.clone(),
|
||||||
|
album: album.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
match self.upload_song_process(&members).await {
|
||||||
Ok(o) => {
|
Ok(o) => {
|
||||||
println!("Response: {o:?}");
|
println!("Response: {o:?}");
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
println!("Error: {err:?}");
|
println!("Error: {err:?}");
|
||||||
|
return Err(err);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(error) => {
|
|
||||||
println!("Error: {error:?}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Err(err) => {
|
||||||
|
println!("Error: {err:?}");
|
||||||
|
Err(std::io::Error::other(err.to_string()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(error) => {
|
||||||
|
println!("Error: {error:?}");
|
||||||
|
Err(std::io::Error::other(error.to_string()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn get_cover_art_path(&self, directory_path: &String) -> Result<String> {
|
fn get_cover_art_path(&self, directory_path: &String) -> Result<String> {
|
||||||
for entry in read_dir(std::path::Path::new(directory_path))? {
|
for entry in read_dir(std::path::Path::new(directory_path))? {
|
||||||
|
|||||||
Reference in New Issue
Block a user