Skip to content

Instantly share code, notes, and snippets.

@raleighlittles
Created November 29, 2024 21:55
Show Gist options
  • Save raleighlittles/ffc38d1263a2abdde2794a3693f4d4e4 to your computer and use it in GitHub Desktop.
Save raleighlittles/ffc38d1263a2abdde2794a3693f4d4e4 to your computer and use it in GitHub Desktop.
Rust snippet to read Sony DSF files and print their metadata
// 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);
}
}
}
@raleighlittles
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment