Compare commits
15 Commits
dev-v0.1.1
...
v0.1.14-de
Author | SHA1 | Date | |
---|---|---|---|
d0e0d8fa2d | |||
3f379cf454 | |||
64f936bb3c | |||
929dac6413 | |||
b91d543097 | |||
9307f80274 | |||
49c732ef1b | |||
5fe0c4ccb4 | |||
7d24ce51cf | |||
474391ea44 | |||
abbb37721f | |||
e366202f24 | |||
950a70ccad | |||
7f8649ee38 | |||
fac33c7987 |
57
.gitea/workflows/tag_release.yaml
Normal file
57
.gitea/workflows/tag_release.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Release Tagging
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- devel
|
||||
tags:
|
||||
- 'v*' # Trigger on tags matching v*
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Important for git describe --tags
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: cargo
|
||||
|
||||
- name: Extract Version from Cargo.toml
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(grep '^version = "' Cargo.toml | sed -E 's/version = "([^"]+)"/\1/')
|
||||
PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10)
|
||||
BRANCH_REF="${GITHUB_REF}"
|
||||
BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3)
|
||||
PROJECT_TAG_RELEASE="v$VERSION-$BRANCH_NAME-$PROJECT_COMMIT_HASH"
|
||||
echo "::set-output name=project_tag_release::$PROJECT_TAG_RELEASE-111"
|
||||
echo "Version: $VERSION"
|
||||
echo "Hash: $PROJECT_COMMIT_HASH"
|
||||
echo "Branch: $BRANCH_NAME"
|
||||
echo "Tag Release: $PROJECT_TAG_RELEASE"
|
||||
|
||||
- name: Print version
|
||||
id: Version
|
||||
run: |
|
||||
echo "Printing version"
|
||||
echo "Version: ${{ steps.version.outputs.project_tag_release }}"
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.version.outputs.project_tag_release }}
|
||||
release_name: Release ${{ steps.version.outputs.project_tag_release }}
|
||||
body: |
|
||||
Release of version ${{ steps.version.outputs.project_tag_release }}
|
||||
# draft: false
|
||||
# prerelease: ${{ startsWith(github.ref, 'v') == false }} # prerelease if not a valid release tag
|
||||
|
56
.gitea/workflows/workflow.yaml
Normal file
56
.gitea/workflows/workflow.yaml
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Rust Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- devel
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- devel
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
- run: cargo check
|
||||
|
||||
test:
|
||||
name: Test Suite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
- run: cargo test
|
||||
|
||||
fmt:
|
||||
name: Rustfmt
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
- run: rustup component add rustfmt
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
- run: rustup component add clippy
|
||||
- run: cargo clippy -- -D warnings
|
||||
|
||||
build:
|
||||
name: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
- run: cargo build
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "icarus-models"
|
||||
version = "0.1.10"
|
||||
version = "0.1.14"
|
||||
edition = "2024"
|
||||
description = "models used for the icarus project"
|
||||
license = "MIT"
|
||||
|
27
src/coverart.rs
Normal file
27
src/coverart.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use std::io::Read;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct CoverArt {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub path: String,
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
impl CoverArt {
|
||||
pub fn to_data(&self) -> Result<Vec<u8>, std::io::Error> {
|
||||
let path: &String = &self.path;
|
||||
let mut file = std::fs::File::open(path)?;
|
||||
let mut buffer = Vec::new();
|
||||
match file.read_to_end(&mut buffer) {
|
||||
Ok(_) => {
|
||||
return Ok(buffer);
|
||||
}
|
||||
Err(err) => {
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
pub mod access_level;
|
||||
pub mod album;
|
||||
pub mod constants;
|
||||
pub mod coverart;
|
||||
pub mod login_result;
|
||||
pub mod song;
|
||||
pub mod token;
|
||||
|
18
src/song.rs
18
src/song.rs
@@ -159,23 +159,13 @@ impl Song {
|
||||
let filename_len = 10;
|
||||
|
||||
let file_extension = match typ {
|
||||
types::types::Types::DefaultMusicExtension =>
|
||||
{
|
||||
types::types::Types::DefaultMusicExtension => {
|
||||
String::from(constants::DEFAULTMUSICEXTENSION)
|
||||
}
|
||||
|
||||
types::types::Types::WavExtension =>
|
||||
{
|
||||
String::from(constants::WAVEXTENSION)
|
||||
}
|
||||
types::types::Types::FlacExtension =>
|
||||
{
|
||||
String::from(constants::FLACEXTENSION)
|
||||
}
|
||||
types::types::Types::MPThreeExtension =>
|
||||
{
|
||||
String::from(constants::MPTHREEEXTENSION)
|
||||
}
|
||||
types::types::Types::WavExtension => String::from(constants::WAVEXTENSION),
|
||||
types::types::Types::FlacExtension => String::from(constants::FLACEXTENSION),
|
||||
types::types::Types::MPThreeExtension => String::from(constants::MPTHREEEXTENSION),
|
||||
};
|
||||
|
||||
if randomize {
|
||||
|
Reference in New Issue
Block a user