[T] Test loading encoders

This commit is contained in:
Azalea Gui
2023-02-24 10:32:49 -05:00
parent 5a96d32af4
commit 12fb9c35c2
2 changed files with 21 additions and 15 deletions
+1
View File
@@ -3,6 +3,7 @@ mod macros;
mod generator;
mod utils;
mod thumbnailer;
mod encoder;
use generator::*;
use macros::*;
+20 -15
View File
@@ -2,9 +2,11 @@ mod generator;
mod macros;
mod utils;
mod thumbnailer;
mod encoder;
use std::path::{Path, PathBuf};
use generator::*;
use crate::encoder::Encoders;
use crate::thumbnailer::{Thumbnailer, Thumbnailers};
extern crate pretty_env_logger;
@@ -13,19 +15,22 @@ extern crate pretty_env_logger;
fn main() {
pretty_env_logger::init();
let gen = Generator::new("/data".into()).unwrap();
let path: PathBuf = "/data/Anime/1977 Star Wars Collection/01 Star Wars Episode I The Phantom Menace - George Lucas 1999 Eng Subs 720p [H264-mp4].mp4".into();
let mime = gen.get_mime(&path)
.expect("Panic");
info!("mime {mime}");
let thumbnailer_path = "/usr/share/thumbnailers/totem.thumbnailer";
let thumbnailer = Thumbnailer::load(Path::new(thumbnailer_path)).unwrap();
info!("thumb {:?}", thumbnailer);
info!("check {:?}", thumbnailer.check("audio/x-mp3"));
thumbnailer.gen(path.to_str().unwrap(), "/tmp/test.png", 256).expect("Generation failed");
let ts = Thumbnailers::load_all().unwrap();
info!("Video thumbnailer: {:?}", ts.find("audio/x-mp3"))
// let gen = Generator::new("/data".into()).unwrap();
//
// let path: PathBuf = "/data/Anime/1977 Star Wars Collection/01 Star Wars Episode I The Phantom Menace - George Lucas 1999 Eng Subs 720p [H264-mp4].mp4".into();
// let mime = gen.get_mime(&path)
// .expect("Panic");
// info!("mime {mime}");
//
// let thumbnailer_path = "/usr/share/thumbnailers/totem.thumbnailer";
// let thumbnailer = Thumbnailer::load(Path::new(thumbnailer_path)).unwrap();
// info!("thumb {:?}", thumbnailer);
// info!("check {:?}", thumbnailer.check("audio/x-mp3"));
// thumbnailer.gen(path.to_str().unwrap(), "/tmp/test.png", 256).expect("Generation failed");
//
// let ts = Thumbnailers::load_all().unwrap();
// info!("Video thumbnailer: {:?}", ts.find("audio/x-mp3"))
let encoders = Encoders::load().unwrap();
info!("Encoders {:?}", encoders);
}