From 300cc8864a5e1f223cde8a8c52e28a11512361d1 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Fri, 4 Apr 2025 21:47:59 +0300 Subject: [PATCH] store source tag --- src/model/entry.rs | 1 - src/model/metadata.rs | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/model/entry.rs b/src/model/entry.rs index 8f63e70..03d1617 100644 --- a/src/model/entry.rs +++ b/src/model/entry.rs @@ -2,7 +2,6 @@ use crate::*; use std::cmp::{Eq, PartialEq, Ord, PartialOrd, Ordering}; use lofty::tag::TagItem; -#[derive(Debug)] pub struct Entry { /// How many levels deep is this from the working directory pub depth: usize, diff --git a/src/model/metadata.rs b/src/model/metadata.rs index 1c6b4f4..25ebf79 100644 --- a/src/model/metadata.rs +++ b/src/model/metadata.rs @@ -2,9 +2,8 @@ use crate::*; use std::fs::File; use std::io::{BufReader, Read}; use byte_unit::{Byte, Unit::MB}; -use lofty::{file::TaggedFileExt, probe::Probe, tag::{Accessor, TagItem, ItemKey, ItemValue}}; +use lofty::{file::TaggedFileExt, probe::Probe, tag::{Accessor, Tag, TagItem, ItemKey, ItemValue}}; -#[derive(Ord, Eq, PartialEq, PartialOrd, Debug)] pub enum Metadata { Directory { hash_file: Option<()>, @@ -13,8 +12,10 @@ pub enum Metadata { release_file: Option<()>, }, Music { + invalid: bool, hash: Arc, size: Arc, + tag: Arc>, artist: Option>, album: Option>, track: Option, @@ -25,14 +26,13 @@ pub enum Metadata { publisher: Option>, key: Option>, bpm: Option>, - invalid: bool, }, Image { + invalid: bool, hash: Arc, size: Arc, title: Option, author: Option, - invalid: bool, }, Unknown { hash: Arc, @@ -66,6 +66,7 @@ impl Metadata { key: None, bpm: None, invalid: false, + tag: tag.map(|t|t.clone()).into(), }) } else { Self::new_fallback(path)