mirror of
https://github.com/Xevion/byte-me.git
synced 2025-12-06 01:14:33 -06:00
chore: solve clippy warnings, export directly into bindings/ dir, remove unreachable expression arms
This commit is contained in:
@@ -2,10 +2,10 @@ mod ff;
|
||||
mod media;
|
||||
mod models;
|
||||
|
||||
use std::path::Path;
|
||||
use models::{MediaType, StreamDetail, StreamResult, StreamResultError};
|
||||
use media::{detect_media_type, is_media_file};
|
||||
use ff::extract_streams;
|
||||
use media::{detect_media_type, is_media_file};
|
||||
use models::{StreamResult, StreamResultError};
|
||||
use std::path::Path;
|
||||
|
||||
// detection, helpers moved to modules above
|
||||
|
||||
@@ -68,10 +68,10 @@ fn has_streams(paths: Vec<String>) -> Result<Vec<StreamResult>, StreamResultErro
|
||||
})
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("Could not analyze media file with ffprobe: {:?}", err);
|
||||
eprintln!("Could not analyze media file with ffprobe: {err:?}");
|
||||
Err(StreamResultError {
|
||||
filename: Some(filename),
|
||||
reason: format!("Could not analyze media file: {}", err),
|
||||
reason: format!("Could not analyze media file: {err}"),
|
||||
error_type: "analysis_failed".to_string(),
|
||||
})
|
||||
}
|
||||
@@ -80,7 +80,7 @@ fn has_streams(paths: Vec<String>) -> Result<Vec<StreamResult>, StreamResultErro
|
||||
// For non-media files, return an error indicating it's not a media file
|
||||
Err(StreamResultError {
|
||||
filename: Some(filename),
|
||||
reason: format!("Not a media file (detected as {:?})", media_type),
|
||||
reason: format!("Not a media file (detected as {media_type:?})"),
|
||||
error_type: "not_media".to_string(),
|
||||
})
|
||||
}
|
||||
@@ -99,13 +99,14 @@ pub fn run() {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::models::StreamDetail;
|
||||
|
||||
use super::*;
|
||||
use ts_rs::TS;
|
||||
|
||||
#[test]
|
||||
fn export_bindings() {
|
||||
// This will generate TypeScript bindings when you run `cargo test export_bindings`
|
||||
StreamResult::export().unwrap();
|
||||
StreamDetail::export().unwrap();
|
||||
StreamResultError::export().unwrap();
|
||||
TS::export_all_to("../../src/bindings")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,11 +117,11 @@ pub fn detect_media_type(path: &Path) -> MediaType {
|
||||
// Archive extensions
|
||||
"zip" | "rar" | "7z" | "tar" | "gz" | "bz2" | "bz3" | "xz" | "swf" | "sqlite"
|
||||
| "nes" | "crx" | "cab" | "deb" | "ar" | "Z" | "lz" | "rpm" | "dcm" | "zst" | "lz4"
|
||||
| "msi" | "cpio" | "par2" | "epub" | "mobi" => MediaType::Archive,
|
||||
| "cpio" | "par2" | "epub" | "mobi" => MediaType::Archive,
|
||||
|
||||
// Executable extensions
|
||||
"exe" | "dll" | "msi" | "dmg" | "pkg" | "deb" | "rpm" | "app" | "elf" | "bc"
|
||||
| "mach" | "class" | "dex" | "dey" | "der" | "obj" => MediaType::Executable,
|
||||
"exe" | "dll" | "msi" | "dmg" | "pkg" | "app" | "elf" | "bc" | "mach" | "class"
|
||||
| "dex" | "dey" | "der" | "obj" => MediaType::Executable,
|
||||
|
||||
// Library extensions
|
||||
"so" | "dylib" => MediaType::Library,
|
||||
|
||||
Reference in New Issue
Block a user