Better function name
This commit is contained in:
parent
7c1a356310
commit
67d39f4172
@ -2,7 +2,7 @@ use std::process;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use id3_image::extract_image;
|
use id3_image::extract_first_image;
|
||||||
|
|
||||||
#[derive(StructOpt, Debug)]
|
#[derive(StructOpt, Debug)]
|
||||||
#[structopt(name = "id3-image-embed")]
|
#[structopt(name = "id3-image-embed")]
|
||||||
@ -26,7 +26,7 @@ fn main() {
|
|||||||
let image_filename = opt.image_filename.clone().
|
let image_filename = opt.image_filename.clone().
|
||||||
unwrap_or_else(|| opt.music_filename.with_extension("jpg"));
|
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);
|
eprintln!("{}", e);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ pub fn embed_image(music_filename: &Path, image_filename: &Path) -> Result<(), B
|
|||||||
Ok(())
|
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).
|
let tag = id3::Tag::read_from_path(&music_filename).
|
||||||
map_err(|e| format!("Error reading music file {:?}: {}", music_filename, e))?;
|
map_err(|e| format!("Error reading music file {:?}: {}", music_filename, e))?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user