Replaced with icarus-models constants
This commit is contained in:
@@ -12,7 +12,7 @@ use crate::models::song::Album;
|
|||||||
use crate::models::{self};
|
use crate::models::{self};
|
||||||
use crate::syncers;
|
use crate::syncers;
|
||||||
use crate::utilities;
|
use crate::utilities;
|
||||||
use crate::{constants, parsers};
|
use crate::parsers;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct CommitManager {
|
pub struct CommitManager {
|
||||||
@@ -186,7 +186,7 @@ impl CommitManager {
|
|||||||
Ok(o) => {
|
Ok(o) => {
|
||||||
println!("Success");
|
println!("Success");
|
||||||
let mut filename = String::from("audio");
|
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 data = o.as_bytes();
|
||||||
let mut file = std::fs::File::create(filename).expect("Failed to save");
|
let mut file = std::fs::File::create(filename).expect("Failed to save");
|
||||||
file.write_all(&data).expect("ff");
|
file.write_all(&data).expect("ff");
|
||||||
|
|||||||
+2
-4
@@ -3,8 +3,6 @@ use std::io::Read;
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::constants;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct Song {
|
pub struct Song {
|
||||||
#[serde(alias = "id")]
|
#[serde(alias = "id")]
|
||||||
@@ -127,9 +125,9 @@ impl Song {
|
|||||||
filename += &self.track.unwrap().to_string();
|
filename += &self.track.unwrap().to_string();
|
||||||
|
|
||||||
if i_type == 0 {
|
if i_type == 0 {
|
||||||
filename += constants::file_extensions::_MP3_FILE_EXTENSION;
|
filename += icarus_models::constants::MPTHREE_EXTENSION;
|
||||||
} else {
|
} else {
|
||||||
filename += constants::file_extensions::WAV_FILE_EXTENSION;
|
filename += icarus_models::constants::WAV_EXTENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.filename = Some(filename);
|
self.filename = Some(filename);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use reqwest;
|
|||||||
use reqwest::multipart::Form;
|
use reqwest::multipart::Form;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::constants;
|
|
||||||
use crate::models;
|
use crate::models;
|
||||||
|
|
||||||
pub struct Upload {
|
pub struct Upload {
|
||||||
@@ -110,9 +109,9 @@ impl Upload {
|
|||||||
let cover = reqwest::multipart::Part::bytes(cover_raw_data).headers(headers_i);
|
let cover = reqwest::multipart::Part::bytes(cover_raw_data).headers(headers_i);
|
||||||
|
|
||||||
let mut song_filename = String::from("audio");
|
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");
|
let mut cover_filename = String::from("cover");
|
||||||
cover_filename += constants::file_extensions::JPG_FILE_EXTENSION;
|
cover_filename += ".jpg";
|
||||||
|
|
||||||
return reqwest::multipart::Form::new()
|
return reqwest::multipart::Form::new()
|
||||||
.part("cover", cover.file_name(cover_filename))
|
.part("cover", cover.file_name(cover_filename))
|
||||||
@@ -128,9 +127,9 @@ impl Upload {
|
|||||||
println!("\n{}\n", song_detail);
|
println!("\n{}\n", song_detail);
|
||||||
|
|
||||||
let mut song_filename = String::from("audio");
|
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");
|
let mut cover_filename = String::from("cover");
|
||||||
cover_filename += constants::file_extensions::JPG_FILE_EXTENSION;
|
cover_filename += ".jpg";
|
||||||
|
|
||||||
let form = reqwest::multipart::Form::new()
|
let form = reqwest::multipart::Form::new()
|
||||||
.part(
|
.part(
|
||||||
|
|||||||
Reference in New Issue
Block a user