Created
November 29, 2024 21:55
-
-
Save raleighlittles/ffc38d1263a2abdde2794a3693f4d4e4 to your computer and use it in GitHub Desktop.
Rust snippet to read Sony DSF files and print their metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see: https://raleighlittles.github.io/blog/walkman-dsf-sample-files/ | |
fn main() { | |
let dsf_filepath_raw: String = std::env::args() | |
.nth(1) | |
.expect("Missing first parameter: DSF file path"); | |
let dsf_filepath = std::path::Path::new(&dsf_filepath_raw); | |
if !dsf_filepath.exists() { | |
panic!("No DSF file with that name '{}' exists", dsf_filepath_raw); | |
} | |
match dsf::DsfFile::open(&dsf_filepath) { | |
Ok(dsf_file) => { | |
println!("{}", dsf_file); | |
} | |
Err(error) => { | |
panic!("Error reading DSF file provided: {}", error); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this crate:
https://crates.io/crates/dsf