5 Commits

Author SHA1 Message Date
KD ca13f101d7 icarus_models version bump (#84)
* icarus_models version bump

* icarus_models related changes

* Removing method

* Code formatting

* Warning fix

* Removing comments

* Version bump

* cargo update
2025-10-19 23:52:43 -04:00
KD 1e4ffc798e Use official icarus_models version (#75)
* icarus_models v0.7.0

* Version bump
2025-10-13 20:58:30 -04:00
KD ecd025346c tsk-70: Rust update (#74)
* Updated rust in workflow

* Updated rust in cargo

* icarus_models version bump

* Version bump

* Workflow changes
2025-10-12 17:06:57 -04:00
KD 74184fa022 Dependency update (#73)
* Cargo update

* Updated crates

* Removed unused file

* Code cleanup

* Version bump

* Removed commented code
2025-10-12 16:57:49 -04:00
KD c2a2ca049d icarus_models version bump (#71)
* icarus_models version bump

* icarus_models related changes

* Warning fixes

* Version bump

* Test fix
2025-10-11 20:05:34 -04:00
9 changed files with 413 additions and 424 deletions
+4 -4
View File
@@ -2,9 +2,9 @@ name: Rust
on:
push:
branches: [ "master" ]
branches: [ "main" ]
pull_request:
branches: [ "master", "icarus_v2_support" ]
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
@@ -15,9 +15,9 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Install Rust version
run: rustup install 1.88.0 && rustup default 1.88.0
run: rustup install 1.90.0 && rustup default 1.90.0
- name: Debug secret
run: echo "${{ secrets.MYREPO_TOKEN }}" | head -c 10 ; echo "..."
Generated
+376 -347
View File
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -1,17 +1,17 @@
[package]
name = "icarus-dm"
version = "0.7.0"
rust-version = "1.88"
version = "0.8.2"
rust-version = "1.90"
edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
futures = { version = "0.3.31" }
http = { version = "1.3.1" }
reqwest = { version = "0.12.20", features = ["json", "blocking", "multipart", "stream"] }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
tokio = { version = "1.45.1", features = ["full"] }
tokio-util = { version = "0.7.15", features = ["codec"] }
uuid = { version = "1.17.0", features = ["v4", "serde"] }
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.5.6" }
reqwest = { version = "0.12.23", features = ["json", "blocking", "multipart", "stream"] }
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.145"
tokio = { version = "1.47.1", features = ["full"] }
tokio-util = { version = "0.7.16", features = ["codec"] }
uuid = { version = "1.18.1", features = ["v4", "serde"] }
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.8.0" }
+1 -1
View File
@@ -63,7 +63,7 @@ mod tests {
match managers::commit_manager::retrieve_song(
&album, track, disc, &directory, &filename,
) {
Ok(song) => match song.to_data() {
Ok(song) => match icarus_models::song::io::to_data(&song) {
Ok(_) => {
print!("Success");
}
+22 -23
View File
@@ -349,11 +349,11 @@ impl CommitManager {
panic!("Error");
}
let pa = std::path::Path::new(&cover_path);
let mut cover_art = icarus_models::coverart::CoverArt {
id: uuid::Uuid::nil(),
title: String::new(),
path: cover_path.to_owned(),
data: Vec::new(),
directory: String::from(pa.parent().unwrap().to_str().unwrap()),
filename: String::from(pa.file_name().unwrap().to_str().unwrap()),
..Default::default()
};
let file_name = std::ffi::OsString::from(&song_file.file_name().unwrap());
@@ -373,15 +373,16 @@ impl CommitManager {
println!("Directory: {:?}", s.directory);
println!("Filename: {:?}", s.filename);
println!("Path: {:?}", s.song_path());
s.data = s.to_data().unwrap();
s.data = icarus_models::song::io::to_data(&s).unwrap();
cover_art.data = cover_art.to_data().unwrap();
cover_art.data =
icarus_models::coverart::io::to_data(&cover_art).unwrap();
let members = UploadSongMembers {
song: s,
coverart: cover_art,
token: token,
album: album,
token,
album,
};
match self.upload_song_process(&members).await {
@@ -496,7 +497,6 @@ impl CommitManager {
};
songs.push(icarus_models::song::Song {
id: uuid::Uuid::nil(),
title: track.title.clone(),
artist: track.artist.clone(),
disc: track.disc,
@@ -511,9 +511,7 @@ impl CommitManager {
audio_type: String::from("FLAC"),
directory: source_directory.to_owned(),
filename: song_filename,
user_id: uuid::Uuid::nil(),
data: Vec::new(),
date_created: String::new(),
..Default::default()
});
}
Ok(songs)
@@ -538,23 +536,26 @@ impl CommitManager {
panic!("Directory does not exist");
}
let coverart_path = self.get_cover_art_path(sourcepath).unwrap_or_default();
let mut cover_art =
icarus_models::coverart::init::init_coverart_only_path(coverart_path.clone());
let (coverart_directory, coverart_filename) =
self.get_coverart_dir_and_filename(sourcepath).unwrap();
let mut cover_art = icarus_models::coverart::init::init_coverart_dir_and_filename(
&coverart_directory,
&coverart_filename,
);
let metadatapath = self.get_metadata_path(sourcepath).unwrap_or_default();
let mut up = syncers::upload::Upload::default();
let host = self.ica_action.retrieve_flag_value(&String::from("-h"));
up.set_api(&host);
cover_art.data = cover_art.to_data().unwrap();
cover_art.data = icarus_models::coverart::io::to_data(&cover_art).unwrap();
match self.get_songs(&metadatapath, sourcepath) {
Ok(sngs) => match icarus_models::album::collection::parse_album(&metadatapath) {
Ok(album) => {
for song in sngs {
let members = UploadSongMembers {
song: song,
song,
coverart: cover_art.clone(),
token: token.clone(),
album: album.clone(),
@@ -585,8 +586,8 @@ impl CommitManager {
}
}
fn get_cover_art_path(&self, directory_path: &String) -> Result<String> {
for entry in read_dir(std::path::Path::new(directory_path))? {
fn get_coverart_dir_and_filename(&self, directory: &str) -> Result<(String, String)> {
for entry in read_dir(std::path::Path::new(directory))? {
let entry = entry?;
let file_type = entry.file_type();
@@ -596,14 +597,12 @@ impl CommitManager {
println!("file name: {file_name:?}");
if let En::ImageFile = self.find_file_extension(&file_name) {
let directory_part = directory_path.clone();
let fname = utilities::string::o_to_string(&file_name);
let fullpath = format!("{}/{}", directory_part, &fname.unwrap());
return Ok(fullpath);
return Ok((directory.to_string(), fname.unwrap()));
}
}
Ok(String::new())
Ok((String::new(), String::new()))
}
fn find_file_extension(&self, file_name: &std::ffi::OsString) -> En {
-1
View File
@@ -1,4 +1,3 @@
pub mod api;
pub mod flags;
pub mod icarus_action;
pub mod upload_form;
-9
View File
@@ -1,9 +0,0 @@
use std::default::Default;
use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Deserialize, Serialize)]
pub struct UploadForm {
pub url: Option<String>,
pub filepath: Option<String>,
}
+1 -1
View File
@@ -176,7 +176,7 @@ impl Upload {
token: &icarus_models::token::AccessToken,
coverart: &icarus_models::coverart::CoverArt,
) -> Result<uuid::Uuid, reqwest::Error> {
let coverartpath = coverart.path.clone();
let coverartpath = coverart.get_path().unwrap();
let file = tokio::fs::File::open(&coverartpath).await.unwrap();
let stream = tokio_util::codec::FramedRead::new(file, tokio_util::codec::BytesCodec::new());
let file_body = reqwest::Body::wrap_stream(stream);
-29
View File
@@ -1,32 +1,3 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub struct Checks {}
impl Checks {
pub fn _is_numeric(text: &str) -> bool {
text.parse::<f64>().is_ok()
}
pub fn _index_of_item_in_container<F>(container: &str, item: &char, func: F) -> i32
where
F: Fn(&char, &char) -> bool,
{
let mut index = -1;
for c in container.chars() {
if func(&c, item) {
index += 1;
break;
}
index += 1;
}
index
}
}
pub fn exit_program(code: i32) {
std::process::exit(code);
}