* Optimizing thumbnail generation so they're 640x?
This makes them literally 30Kb on average for my personal use Also they're thumbnails so they could actually be smaller ! forcing thumbnails to be jpg as well
This commit is contained in:
parent
5e3b2e830b
commit
f42f125766
@ -11,11 +11,9 @@ pub async fn get(file: PathBuf) -> Option<NamedFile> {
|
|||||||
if file_path.is_file() {
|
if file_path.is_file() {
|
||||||
return match file_path.extension() {
|
return match file_path.extension() {
|
||||||
Some(ext) => {
|
Some(ext) => {
|
||||||
if ext == "jpg" || ext == "png" || ext == "jpeg" {
|
match ext == "jpg" {
|
||||||
NamedFile::open(file_path).await.ok()
|
true => NamedFile::open(file_path).await.ok(),
|
||||||
} else {
|
false => None
|
||||||
println!("bad extension");
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => None
|
None => None
|
||||||
|
@ -48,7 +48,7 @@ pub fn list(cat: PathBuf) -> Option<Json<Vec<VideoPreview>>> {
|
|||||||
let name = name.to_string_lossy();
|
let name = name.to_string_lossy();
|
||||||
|
|
||||||
let cat = cat.to_string_lossy();
|
let cat = cat.to_string_lossy();
|
||||||
let thumbnail = format!("/thumbnail/{}/{}", cat, name);
|
let thumbnail = format!("/thumbnail/{}/{}.jpg", cat, name);
|
||||||
|
|
||||||
let item = VideoPreview {
|
let item = VideoPreview {
|
||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
|
@ -43,6 +43,8 @@ pushd "$vids" > /dev/null
|
|||||||
# Make sure only errors pop up here
|
# Make sure only errors pop up here
|
||||||
ffmpeg -hide_banner -loglevel error \
|
ffmpeg -hide_banner -loglevel error \
|
||||||
-y -ss 00:00:01 -i "$if" -frames:v 1 "$of.jpg" > /dev/null
|
-y -ss 00:00:01 -i "$if" -frames:v 1 "$of.jpg" > /dev/null
|
||||||
|
ffmpeg -hide_banner -loglevel error \
|
||||||
|
-y -i "$of.jpg" -vf scale=640:-1 "$of.jpg" > /dev/null
|
||||||
echo $of
|
echo $of
|
||||||
done
|
done
|
||||||
popd > /dev/null
|
popd > /dev/null
|
Loading…
Reference in New Issue
Block a user