From b92e835d1a06b9b6112cb97cf786f2621fa2cf42 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Thu, 23 Feb 2023 13:47:19 -0500 Subject: [PATCH] [+] Load all thumbnailers --- backend/src/thumbnailer.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/src/thumbnailer.rs b/backend/src/thumbnailer.rs index 2dd47da..7e34a79 100644 --- a/backend/src/thumbnailer.rs +++ b/backend/src/thumbnailer.rs @@ -38,6 +38,14 @@ impl Thumbnailer { Ok(t) } + /// Load all thumbanilers available in the system + pub fn load_all() -> Result> { + Ok(fs::read_dir("/usr/share/thumbnailers")? + .filter_map(|f| f.ok()) + .filter_map(|f| Thumbnailer::load(&*f.path()).ok()) + .collect()) + } + /// Check if this thumbnailer should run on a specific mime type pub fn check(&self, mime: &str) -> bool { self.mime_type.contains(mime)