store source tag

This commit is contained in:
🪞👃🪞 2025-04-04 21:47:59 +03:00
parent 72607e482c
commit 300cc8864a
2 changed files with 5 additions and 5 deletions

View file

@ -2,7 +2,6 @@ use crate::*;
use std::cmp::{Eq, PartialEq, Ord, PartialOrd, Ordering}; use std::cmp::{Eq, PartialEq, Ord, PartialOrd, Ordering};
use lofty::tag::TagItem; use lofty::tag::TagItem;
#[derive(Debug)]
pub struct Entry { pub struct Entry {
/// How many levels deep is this from the working directory /// How many levels deep is this from the working directory
pub depth: usize, pub depth: usize,

View file

@ -2,9 +2,8 @@ use crate::*;
use std::fs::File; use std::fs::File;
use std::io::{BufReader, Read}; use std::io::{BufReader, Read};
use byte_unit::{Byte, Unit::MB}; 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 { pub enum Metadata {
Directory { Directory {
hash_file: Option<()>, hash_file: Option<()>,
@ -13,8 +12,10 @@ pub enum Metadata {
release_file: Option<()>, release_file: Option<()>,
}, },
Music { Music {
invalid: bool,
hash: Arc<str>, hash: Arc<str>,
size: Arc<str>, size: Arc<str>,
tag: Arc<Option<Tag>>,
artist: Option<Arc<str>>, artist: Option<Arc<str>>,
album: Option<Arc<str>>, album: Option<Arc<str>>,
track: Option<u32>, track: Option<u32>,
@ -25,14 +26,13 @@ pub enum Metadata {
publisher: Option<Arc<str>>, publisher: Option<Arc<str>>,
key: Option<Arc<str>>, key: Option<Arc<str>>,
bpm: Option<Arc<str>>, bpm: Option<Arc<str>>,
invalid: bool,
}, },
Image { Image {
invalid: bool,
hash: Arc<str>, hash: Arc<str>,
size: Arc<str>, size: Arc<str>,
title: Option<String>, title: Option<String>,
author: Option<String>, author: Option<String>,
invalid: bool,
}, },
Unknown { Unknown {
hash: Arc<str>, hash: Arc<str>,
@ -66,6 +66,7 @@ impl Metadata {
key: None, key: None,
bpm: None, bpm: None,
invalid: false, invalid: false,
tag: tag.map(|t|t.clone()).into(),
}) })
} else { } else {
Self::new_fallback(path) Self::new_fallback(path)