Compare commits

...

8 Commits

Author SHA1 Message Date
phoenix ed9cdf8d7a workflow_fix (#12)
Reviewed-on: #12
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-04-12 18:37:00 +00:00
phoenix 84b9cf19b5 Added code to get tag info (#10)
Reviewed-on: #10
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-04-12 17:52:52 +00:00
phoenix 0db41e55b4 Minimum rust version (#11)
Reviewed-on: #11
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-04-12 17:31:15 +00:00
phoenix faf06d0d7e Icarus-models update (#9)
Reviewed-on: #9
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-04-12 02:33:31 +00:00
phoenix b9da051438 test_files (#6)
Reviewed-on: #6
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-04-12 02:21:15 +00:00
phoenix e5618fcd18 Workflow changes (#7)
Reviewed-on: #7
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-04-12 02:16:33 +00:00
phoenix 634908e060 Updated icarus_models (#5)
Reviewed-on: #5
2025-03-30 17:50:20 +00:00
KD d2540e2513 Updated icarus_models 2025-03-30 13:46:20 -04:00
7 changed files with 120 additions and 17 deletions
+1 -3
View File
@@ -5,8 +5,6 @@ on:
branches:
- main
- devel
tags:
- 'v*' # Trigger on tags matching v*
jobs:
release:
@@ -20,7 +18,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.85.0
toolchain: 1.86.0
components: cargo
- name: Extract Version from Cargo.toml
+6 -7
View File
@@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.85.0
toolchain: 1.86.0
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/gitlab_deploy_key
@@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.85.0
toolchain: 1.86.0
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/gitlab_deploy_key
@@ -54,7 +54,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.85.0
toolchain: 1.86.0
- run: rustup component add rustfmt
- run: |
mkdir -p ~/.ssh
@@ -73,7 +73,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.85.0
toolchain: 1.86.0
- run: rustup component add clippy
- run: |
mkdir -p ~/.ssh
@@ -92,7 +92,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.85.0
toolchain: 1.86.0
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/gitlab_deploy_key
@@ -100,5 +100,4 @@ jobs:
ssh-keyscan ${{ vars.MYHOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/gitlab_deploy_key
cargo build --release
cargo build --release
+3 -2
View File
@@ -2,7 +2,8 @@
name = "icarus_meta"
version = "0.1.0"
edition = "2024"
rust-version = "1.86"
[dependencies]
taglib = { version = "1.0.0" }
icarus-models = { git = "ssh://git@git.kundeng.us/phoenix/icarus-models.git", tag = "v0.1.14" }
metadata = { version = "0.1.10" }
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.4.3" }
+110 -5
View File
@@ -1,5 +1,93 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
pub mod meta_type {
pub enum Type {
Title,
Artist,
Album,
Genre,
Year,
Track,
}
}
pub mod meta_nouveaou {
use super::*;
pub fn get_meta(t: meta_type::Type, filepath: &String) -> Result<String, std::io::Error> {
match t {
meta_type::Type::Title => match new_meta(filepath) {
Ok(metaa) => match get_val(t, metaa.tags) {
Ok(val) => Ok(val),
Err(err) => Err(err),
},
Err(err) => Err(err),
},
meta_type::Type::Artist => match new_meta(filepath) {
Ok(metaa) => match get_val(t, metaa.tags) {
Ok(val) => Ok(val),
Err(err) => Err(err),
},
Err(err) => Err(err),
},
meta_type::Type::Album => match new_meta(filepath) {
Ok(metaa) => match get_val(t, metaa.tags) {
Ok(val) => Ok(val),
Err(err) => Err(err),
},
Err(err) => Err(err),
},
meta_type::Type::Genre => match new_meta(filepath) {
Ok(metaa) => match get_val(t, metaa.tags) {
Ok(val) => Ok(val),
Err(err) => Err(err),
},
Err(err) => Err(err),
},
meta_type::Type::Year => match new_meta(filepath) {
Ok(metaa) => match get_val(t, metaa.tags) {
Ok(val) => Ok(val),
Err(err) => Err(err),
},
Err(err) => Err(err),
},
meta_type::Type::Track => match new_meta(filepath) {
Ok(metaa) => match get_val(t, metaa.tags) {
Ok(val) => Ok(val),
Err(err) => Err(err),
},
Err(err) => Err(err),
},
}
}
fn get_type(t: meta_type::Type) -> Result<String, std::io::Error> {
match t {
meta_type::Type::Title => Ok("TITLE".to_string()),
meta_type::Type::Artist => Ok("ARTIST".to_string()),
meta_type::Type::Album => Ok("".to_string()),
meta_type::Type::Genre => Ok("".to_string()),
meta_type::Type::Year => Ok("".to_string()),
meta_type::Type::Track => Ok("".to_string()),
}
}
fn get_val(t: meta_type::Type, tags: Vec<(String, String)>) -> Result<String, std::io::Error> {
let type_ma: String = get_type(t).unwrap();
for tag in tags {
if tag.0 == type_ma {
return Ok(tag.1);
}
}
Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
"Invalid",
))
}
fn new_meta(filepath: &String) -> Result<metadata::MediaFileMetadata, std::io::Error> {
let path = std::path::Path::new(&filepath);
metadata::MediaFileMetadata::new(&path)
}
}
#[cfg(test)]
@@ -7,8 +95,25 @@ mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
fn test_get_title() {
let filename = String::from("track01.flac");
let dir = String::from("tests/sample_tracks3");
let dir_path = std::path::Path::new(&dir);
let full_path = dir_path.join(filename);
println!("Path: {:?}", full_path);
assert!(full_path.exists(), "Path does not exists {:?}", full_path);
let filepath = full_path.display().to_string();
match meta_nouveaou::get_meta(meta_type::Type::Title, &filepath) {
Ok(title) => {
let found = title == "Just roll it";
assert!(found, "Meta information was not found {:?}", title);
}
Err(err) => {
assert!(false, "Error: {:?}", err);
}
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.