From 63fb8890eea04f824535717cd4a457cb4eb3c22e Mon Sep 17 00:00:00 2001 From: KeksNino Date: Wed, 19 Aug 2026 16:18:16 +0200 Subject: [PATCH] feat: basic tag reading --- .gitignore | 2 ++ flake.lock | 82 ----------------------------------------------------- src/main.rs | 29 +++++++++++++++++-- 3 files changed, 29 insertions(+), 84 deletions(-) delete mode 100644 flake.lock diff --git a/.gitignore b/.gitignore index ea8c4bf..aa4cd78 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target +*.flac +*.mp3 diff --git a/flake.lock b/flake.lock deleted file mode 100644 index f550955..0000000 --- a/flake.lock +++ /dev/null @@ -1,82 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1786993761, - "narHash": "sha256-1LU+eVzo7NRDq41O60TWWuSfE9nziXuN1AcU0STCR9k=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "8b7dc2ca50dd99ca3af5af1436b06b5adb1e54c9", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay", - "utils": "utils" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1787022047, - "narHash": "sha256-wNlYM/obKOkkRELrOfto1JT5CRANR6hB/RjOELp223U=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "b32685dd7c5a965aa8273adb7ddaf7f5b40d0faa", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/src/main.rs b/src/main.rs index e7a11a9..3066870 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,28 @@ -fn main() { - println!("Hello, world!"); +use lofty::file::TaggedFileExt; +use lofty::probe::Probe; +use std::env; + +fn main() -> Result<(), Box> { + let args: Vec = env::args().collect(); + + if args.len() < 2 { + return Err("Not a file. Usage: music-sort ".into()); + } + + let file_path = &args[1]; + + let tagged_file = Probe::open(file_path) + .expect("ERROR: Bad path provided!") + .read() + .expect("ERROR: Failed to read file!"); + + let id3v2 = tagged_file.primary_tag(); + + if let Some(tag) = id3v2 { + for item in tag.items() { + println!("{:?}", item); + } + } + + Ok(()) }