Multi upload #64

Merged
kdeng00 merged 6 commits from multi-upload into upload_song 2025-08-29 21:57:41 -04:00
4 changed files with 33 additions and 19 deletions
Generated
+1 -1
View File
@@ -479,7 +479,7 @@ dependencies = [
[[package]]
name = "icarus-dm"
version = "0.6.1"
version = "0.6.2"
dependencies = [
"futures",
"http",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "icarus-dm"
version = "0.6.1"
version = "0.6.2"
rust-version = "1.88"
edition = "2024"
+2 -2
View File
@@ -48,13 +48,13 @@ icarus-dm download -u spacecadet -p stellar40 -h https://icarus.com -b e8407fc6-
### Uploading Song with metadata
```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
```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
+29 -15
View File
@@ -332,6 +332,7 @@ impl CommitManager {
}
}
/// Only uploading one song
async fn sing_target_upload(
&mut self,
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<()> {
let mut up = syncers::upload::Upload::default();
let host = self.ica_action.retrieve_flag_value(&String::from("-h"));
@@ -558,27 +560,39 @@ impl CommitManager {
cover_art.data = cover_art.to_data().unwrap();
match self.get_songs(&metadatapath, sourcepath) {
Ok(sngs) => {
for song in sngs {
match Runtime::new()
.unwrap()
.block_on(up.upload_song_with_metadata(&token, &song, &cover_art))
{
Ok(o) => {
println!("Response: {o:?}");
Ok(sngs) => match icarus_models::album::collection::parse_album(&metadatapath) {
Ok(album) => {
for song in sngs {
let members = UploadSongMembers {
song: song,
coverart: cover_art.clone(),
token: token.clone(),
album: album.clone(),
};
match self.upload_song_process(&members).await {
Ok(o) => {
println!("Response: {o:?}");
}
Err(err) => {
println!("Error: {err:?}");
return Err(err);
}
}
Err(err) => {
println!("Error: {err:?}");
}
};
}
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()))
}
}
Ok(())
}
fn get_cover_art_path(&self, directory_path: &String) -> Result<String> {