Compare commits

...

6 Commits

Author SHA1 Message Date
phoenix de7e27251c tsk-72: Formatting 2025-10-18 19:59:27 -04:00
phoenix 01f24bcda6 tsk-72: Added method to get path 2025-10-18 19:57:39 -04:00
phoenix 9db4810a7b Updated build workflow 2025-10-18 16:09:41 -04:00
phoenix 146014f9f3 Updated release tagging workflow 2025-10-18 16:08:43 -04:00
phoenix 3c6675de1e tsk-72: Adding directory and filename to coverart 2025-10-18 15:55:52 -04:00
phoenix 11e5b1745c tsk-59 (#70)
Closes #59

Reviewed-on: #70
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-12 20:44:23 +00:00
5 changed files with 47 additions and 15 deletions
+3 -2
View File
@@ -4,20 +4,21 @@ on:
pull_request:
branches:
- main
- next-v0.8
jobs:
release:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
fetch-depth: 0 # Important for git describe --tags
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
components: cargo
- name: Extract Version from Cargo.toml
+11 -10
View File
@@ -7,36 +7,37 @@ on:
pull_request:
branches:
- main
- next-v0.8
jobs:
check:
name: Check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: cargo check
test:
name: Test Suite
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: cargo test
fmt:
name: Rustfmt
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
@@ -44,10 +45,10 @@ jobs:
name: Clippy
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: rustup component add clippy
- run: cargo clippy -- -D warnings
@@ -55,10 +56,10 @@ jobs:
name: build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: cargo build
Generated
+1 -1
View File
@@ -149,7 +149,7 @@ checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
[[package]]
name = "icarus_models"
version = "0.6.7"
version = "0.7.0"
dependencies = [
"josekit",
"rand",
+2 -2
View File
@@ -1,8 +1,8 @@
[package]
name = "icarus_models"
version = "0.6.7"
version = "0.7.0"
edition = "2024"
rust-version = "1.88"
rust-version = "1.90"
description = "models used for the icarus project"
license = "MIT"
+30
View File
@@ -7,6 +7,9 @@ pub struct CoverArt {
pub id: uuid::Uuid,
pub title: String,
#[serde(skip)]
pub directory: String,
pub filename: String,
#[serde(skip)]
pub path: String,
#[serde(skip)]
pub data: Vec<u8>,
@@ -23,6 +26,7 @@ pub mod init {
path: path.clone(),
data: Vec::new(),
song_id: uuid::Uuid::nil(),
..Default::default()
}
}
}
@@ -53,6 +57,32 @@ impl CoverArt {
))
}
}
/// Gets the path of the CoverArt
pub fn get_path(&self) -> Result<String, std::io::Error> {
if self.directory.is_empty() {
return Err(std::io::Error::other("Directory has not been initialized"));
} else if self.filename.is_empty() {
return Err(std::io::Error::other("Filename has not bee initialized"));
}
let directory = &self.directory;
let last_index = directory.len() - 1;
if let Some(character) = directory.chars().nth(last_index) {
let buffer = if character != '/' {
directory.clone() + "/"
} else {
directory.clone()
};
Ok(buffer + &self.filename.clone())
} else {
Err(std::io::Error::other(
"Could not access last character of directory",
))
}
}
}
pub mod io {