From 4f027c039ab4817fe3d28c5bcce6c391c2076f4a Mon Sep 17 00:00:00 2001 From: Jakub Trzeciak Date: Thu, 15 Feb 2024 21:15:34 +0100 Subject: fix formating --- src/main.rs | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/main.rs b/src/main.rs index 78081a4..e06981e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,5 @@ use std::{env, fs::{self, File}, path::Path, io::{Error, BufReader, Read}, fmt::format, os::fd::IntoRawFd}; - use lofty::{Probe, TaggedFileExt, LoftyError, TagExt, Tag, Picture, Accessor, PictureType}; - use clap::Parser; #[derive(Parser, Debug)] @@ -17,12 +15,12 @@ struct Args { } /* - Title - Artist - Title - Artist - Album - Title - Artist - Album - Nr - Title - Artist - Album - Nr - Max Nr - Title - */ + Title + Artist - Title + Artist - Album - Title + Artist - Album - Nr - Title + Artist - Album - Nr - Max Nr - Title + */ struct InnerTag { title: String, @@ -114,25 +112,25 @@ fn truncate(s: &str, min_chars: usize, max_chars: usize) -> &str { } fn tag_ogg_file(path: &Path) -> Result<(), LoftyError> { - let mut tagged_file = Probe::open(path) - .expect("ERROR: Bad path provided!") - .read()?; - - let tag = match tagged_file.primary_tag_mut() { - Some(primary_tag) => primary_tag, - None => { - if let Some(first_tag) = tagged_file.first_tag_mut() { - first_tag - } else { - let tag_type = tagged_file.primary_tag_type(); - - eprintln!("👻 No tags found, creating a new tag of type `{tag_type:?}`"); - tagged_file.insert_tag(Tag::new(tag_type)); - - tagged_file.primary_tag_mut().unwrap() - } - }, - }; + let mut tagged_file = Probe::open(path) + .expect("ERROR: Bad path provided!") + .read()?; + + let tag = match tagged_file.primary_tag_mut() { + Some(primary_tag) => primary_tag, + None => { + if let Some(first_tag) = tagged_file.first_tag_mut() { + first_tag + } else { + let tag_type = tagged_file.primary_tag_type(); + + eprintln!("👻 No tags found, creating a new tag of type `{tag_type:?}`"); + tagged_file.insert_tag(Tag::new(tag_type)); + + tagged_file.primary_tag_mut().unwrap() + } + }, + }; let path_without_ext = path.with_extension(""); let name = path_without_ext.file_name().unwrap().to_str().unwrap(); -- cgit v1.2.3