auto impl getters/setters on Entry

This commit is contained in:
🪞👃🪞 2025-04-06 16:36:56 +03:00
parent 4619d0ea76
commit 44a2108585
3 changed files with 43 additions and 54 deletions

View file

@ -1,6 +1,5 @@
use crate::*;
use std::cmp::{Eq, PartialEq, Ord, PartialOrd, Ordering};
use lofty::tag::TagItem;
pub struct Entry {
/// How many levels deep is this from the working directory
@ -50,42 +49,6 @@ impl Entry {
pub fn is_image (&self) -> bool {
matches!(&*self.info.read().unwrap(), Metadata::Image { .. })
}
pub fn hash (&self) -> Option<Arc<str>> {
self.info.read().unwrap().hash()
}
pub fn size (&self) -> Option<Arc<str>> {
self.info.read().unwrap().size()
}
pub fn artist (&self) -> Option<Arc<str>> {
self.info.read().unwrap().artist()
}
pub fn year (&self) -> Option<Arc<str>> {
self.info.read().unwrap().year()
}
pub fn album (&self) -> Option<Arc<str>> {
self.info.read().unwrap().album()
}
pub fn title (&self) -> Option<Arc<str>> {
self.info.read().unwrap().title()
}
pub fn track (&self) -> Option<Arc<str>> {
self.info.read().unwrap().track()
}
pub fn set_artist (&self, value: &impl AsRef<str>) -> Option<TagItem> {
self.info.write().unwrap().set_artist(value)
}
pub fn set_year (&self, value: &impl AsRef<str>) -> Option<TagItem> {
self.info.write().unwrap().set_year(value)
}
pub fn set_album (&self, value: &impl AsRef<str>) -> Option<TagItem> {
self.info.write().unwrap().set_album(value)
}
pub fn set_title (&self, value: &impl AsRef<str>) -> Option<TagItem> {
self.info.write().unwrap().set_title(value)
}
pub fn set_track (&self, value: &impl AsRef<str>) -> Option<TagItem> {
self.info.write().unwrap().set_track(value)
}
pub const ICON_DIRECTORY: &'static str = "";
pub const ICON_IMAGE: &'static str = "󰋩";
pub const ICON_MUSIC: &'static str = "";