Better function name

This commit is contained in:
Andrew Radev 2019-02-24 16:20:14 +02:00
parent 7c1a356310
commit 67d39f4172
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ use std::process;
use std::path::PathBuf;
use structopt::StructOpt;
use id3_image::extract_image;
use id3_image::extract_first_image;
#[derive(StructOpt, Debug)]
#[structopt(name = "id3-image-embed")]
@ -26,7 +26,7 @@ fn main() {
let image_filename = opt.image_filename.clone().
unwrap_or_else(|| opt.music_filename.with_extension("jpg"));
if let Err(e) = extract_image(&opt.music_filename, &image_filename) {
if let Err(e) = extract_first_image(&opt.music_filename, &image_filename) {
eprintln!("{}", e);
process::exit(1);
}

View File

@ -25,7 +25,7 @@ pub fn embed_image(music_filename: &Path, image_filename: &Path) -> Result<(), B
Ok(())
}
pub fn extract_image(music_filename: &Path, image_filename: &Path) -> Result<(), Box<Error>> {
pub fn extract_first_image(music_filename: &Path, image_filename: &Path) -> Result<(), Box<Error>> {
let tag = id3::Tag::read_from_path(&music_filename).
map_err(|e| format!("Error reading music file {:?}: {}", music_filename, e))?;