mirror of
https://github.com/CDrummond/bliss-analyser.git
synced 2025-04-08 05:00:02 +03:00
Add Metadata::is_empty
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
parent
e0a6759af5
commit
b097f06b5f
@ -154,11 +154,7 @@ pub fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec<String>)
|
||||
Ok(track) => {
|
||||
let cpath = String::from(path);
|
||||
let meta = tags::read(&cpath);
|
||||
if meta.title.is_empty()
|
||||
&& meta.artist.is_empty()
|
||||
&& meta.album.is_empty()
|
||||
&& meta.genre.is_empty()
|
||||
{
|
||||
if meta.is_empty() {
|
||||
tag_error.push(sname.clone());
|
||||
}
|
||||
|
||||
@ -180,7 +176,7 @@ pub fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec<String>)
|
||||
let total = failed.len();
|
||||
failed.truncate(MAX_ERRORS_TO_SHOW);
|
||||
|
||||
log::error!("Failed to analyse the folling track(s):");
|
||||
log::error!("Failed to analyse the following track(s):");
|
||||
for err in failed {
|
||||
log::error!(" {}", err);
|
||||
}
|
||||
@ -192,7 +188,7 @@ pub fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec<String>)
|
||||
let total = tag_error.len();
|
||||
tag_error.truncate(MAX_TAG_ERRORS_TO_SHOW);
|
||||
|
||||
log::error!("Failed to read tags of the folling track(s):");
|
||||
log::error!("Failed to read tags of the following track(s):");
|
||||
for err in tag_error {
|
||||
log::error!(" {}", err);
|
||||
}
|
||||
|
10
src/db.rs
10
src/db.rs
@ -34,6 +34,16 @@ pub struct Metadata {
|
||||
pub duration: u32,
|
||||
}
|
||||
|
||||
impl Metadata {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.title.is_empty()
|
||||
&& self.artist.is_empty()
|
||||
&& self.album_artist.is_empty()
|
||||
&& self.album.is_empty()
|
||||
&& self.genre.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Db {
|
||||
pub conn: Connection,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user