Replaced with icarus-models constants

This commit is contained in:
phoenix
2025-03-13 20:58:19 -04:00
parent 038142eb8a
commit df60bef381
3 changed files with 8 additions and 11 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ use crate::models::song::Album;
use crate::models::{self};
use crate::syncers;
use crate::utilities;
use crate::{constants, parsers};
use crate::parsers;
#[derive(Debug, Deserialize, Serialize)]
pub struct CommitManager {
@@ -186,7 +186,7 @@ impl CommitManager {
Ok(o) => {
println!("Success");
let mut filename = String::from("audio");
filename += constants::file_extensions::WAV_FILE_EXTENSION;
filename += icarus_models::constants::WAV_EXTENSION;
let data = o.as_bytes();
let mut file = std::fs::File::create(filename).expect("Failed to save");
file.write_all(&data).expect("ff");
+2 -4
View File
@@ -3,8 +3,6 @@ use std::io::Read;
use serde::{Deserialize, Serialize};
use crate::constants;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Song {
#[serde(alias = "id")]
@@ -127,9 +125,9 @@ impl Song {
filename += &self.track.unwrap().to_string();
if i_type == 0 {
filename += constants::file_extensions::_MP3_FILE_EXTENSION;
filename += icarus_models::constants::MPTHREE_EXTENSION;
} else {
filename += constants::file_extensions::WAV_FILE_EXTENSION;
filename += icarus_models::constants::WAV_EXTENSION;
}
self.filename = Some(filename);
+4 -5
View File
@@ -6,7 +6,6 @@ use reqwest;
use reqwest::multipart::Form;
use serde::{Deserialize, Serialize};
use crate::constants;
use crate::models;
pub struct Upload {
@@ -110,9 +109,9 @@ impl Upload {
let cover = reqwest::multipart::Part::bytes(cover_raw_data).headers(headers_i);
let mut song_filename = String::from("audio");
song_filename += constants::file_extensions::WAV_FILE_EXTENSION;
song_filename += icarus_models::constants::WAV_EXTENSION;
let mut cover_filename = String::from("cover");
cover_filename += constants::file_extensions::JPG_FILE_EXTENSION;
cover_filename += ".jpg";
return reqwest::multipart::Form::new()
.part("cover", cover.file_name(cover_filename))
@@ -128,9 +127,9 @@ impl Upload {
println!("\n{}\n", song_detail);
let mut song_filename = String::from("audio");
song_filename += constants::file_extensions::WAV_FILE_EXTENSION;
song_filename += icarus_models::constants::WAV_EXTENSION;
let mut cover_filename = String::from("cover");
cover_filename += constants::file_extensions::JPG_FILE_EXTENSION;
cover_filename += ".jpg";
let form = reqwest::multipart::Form::new()
.part(