Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
55b51db4a0 | |||
76e28fc626 | |||
7b5cb41f4a | |||
fc362e4e21 | |||
689dbaf29a | |||
36ac93414b | |||
5b92d8857c | |||
03f5647d53 | |||
448c81fd1e | |||
67aaba4fbf |
@@ -44,10 +44,10 @@ deploy:
|
|||||||
stage: deploy
|
stage: deploy
|
||||||
image: rust:1.85
|
image: rust:1.85
|
||||||
script:
|
script:
|
||||||
- echo "Printing environment"
|
- echo "Deployment will be configured when this is ready for use"
|
||||||
- env
|
# - env
|
||||||
- cargo login "$CARGO_LOGIN_TOKEN"
|
# Uncomment when you are ready for this to be published
|
||||||
- echo "Next step"
|
# - cargo login "$CARGO_LOGIN_TOKEN"
|
||||||
# - cargo publish
|
# - cargo publish
|
||||||
dependencies:
|
dependencies:
|
||||||
- build
|
- build
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
name = "icarus-models"
|
name = "icarus-models"
|
||||||
description = "models used for the icarus project"
|
description = "models used for the icarus project"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "0.1.1"
|
version = "0.1.3"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@@ -19,6 +19,25 @@ impl Default for AccessLevel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub fn default_level() -> AccessLevel {
|
||||||
|
return AccessLevel {
|
||||||
|
id: -1,
|
||||||
|
level: String::from("Public"),
|
||||||
|
song_id: -1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn private_level() -> AccessLevel {
|
||||||
|
return AccessLevel {
|
||||||
|
id: -1,
|
||||||
|
level: String::from("Private"),
|
||||||
|
song_id: -1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl AccessLevel {
|
impl AccessLevel {
|
||||||
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
||||||
return serde_json::to_string_pretty(&self);
|
return serde_json::to_string_pretty(&self);
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
pub mod access_level;
|
pub mod access_level;
|
||||||
pub mod login_result;
|
pub mod login_result;
|
||||||
|
pub mod song;
|
||||||
pub mod token;
|
pub mod token;
|
||||||
|
pub mod types;
|
||||||
pub mod user;
|
pub mod user;
|
||||||
|
|
||||||
pub fn add(left: u64, right: u64) -> u64 {
|
pub fn add(left: u64, right: u64) -> u64 {
|
||||||
|
73
src/song.rs
Normal file
73
src/song.rs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
use std::default::Default;
|
||||||
|
use std::io::Read;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Song {
|
||||||
|
#[serde(alias = "id")]
|
||||||
|
pub id: Option<i32>,
|
||||||
|
pub title: Option<String>,
|
||||||
|
pub artist: Option<String>,
|
||||||
|
pub album: Option<String>,
|
||||||
|
pub album_artist: Option<String>,
|
||||||
|
pub genre: Option<String>,
|
||||||
|
pub year: Option<i32>,
|
||||||
|
pub duration: Option<i32>,
|
||||||
|
pub track: Option<i32>,
|
||||||
|
pub disc: Option<i32>,
|
||||||
|
pub disc_count: Option<i32>,
|
||||||
|
pub track_count: Option<i32>,
|
||||||
|
pub audio_type: Option<String>,
|
||||||
|
pub date_created: Option<String>,
|
||||||
|
pub filename: Option<String>,
|
||||||
|
pub user_id: Option<i32>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub data: Option<Vec<u8>>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub directory: Option<String>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub album_id: Option<i32>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub artist_id: Option<i32>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub genre_id: Option<i32>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub coverart_id: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Song {
|
||||||
|
fn default() -> Self {
|
||||||
|
Song {
|
||||||
|
id: None,
|
||||||
|
title: None,
|
||||||
|
artist: None,
|
||||||
|
album: None,
|
||||||
|
album_artist: None,
|
||||||
|
genre: None,
|
||||||
|
year: None,
|
||||||
|
duration: None,
|
||||||
|
track: None,
|
||||||
|
disc: None,
|
||||||
|
disc_count: None,
|
||||||
|
track_count: None,
|
||||||
|
audio_type: None,
|
||||||
|
date_created: None,
|
||||||
|
filename: None,
|
||||||
|
user_id: None,
|
||||||
|
data: None,
|
||||||
|
directory: None,
|
||||||
|
album_id: None,
|
||||||
|
artist_id: None,
|
||||||
|
genre_id: None,
|
||||||
|
coverart_id: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Song {
|
||||||
|
// TODO: Implement
|
||||||
|
pub fn to_metadata_json(&self) -> Result<String, serde_json::Error> {
|
||||||
|
return serde_json::to_string_pretty(&self);
|
||||||
|
}
|
||||||
|
}
|
9
src/types.rs
Normal file
9
src/types.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
use std::default::Default;
|
||||||
|
|
||||||
|
mod types {
|
||||||
|
pub enum Types {
|
||||||
|
WAV_EXTENSION,
|
||||||
|
FLAC_EXTENSION,
|
||||||
|
MP_EXTENSION,
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user