Generate mp4 thumbnails

This commit is contained in:
Cameron Cordes
2020-07-16 21:24:10 -04:00
parent a49619c98c
commit 7dbd93cedc
2 changed files with 23 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
use crate::data::{Claims, CreateAccountRequest, Token};
use crate::database::{create_user, get_user, user_exists};
use crate::files::list_files;
use crate::video::create_playlist;
use crate::video::*;
mod data;
mod database;
@@ -201,7 +201,13 @@ async fn create_thumbnails() {
if let Some(ext) = entry.path().extension().and_then(|ext| {
ext.to_str().map(|ext| ext.to_lowercase())
}) {
ext == "jpg" || ext == "jpeg" || ext == "png"
if ext == "mp4" {
let thumb = Path::new(thumbnail_directory).join(entry.path().file_name().unwrap());
generate_video_thumbnail(entry.path(), &thumb);
false
} else {
ext == "jpg" || ext == "jpeg" || ext == "png"
}
} else {
false
}