From b61b58ce2c1371d6f904f108fa7feed3abfbe5c7 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Wed, 8 Apr 2026 13:18:14 +0900 Subject: * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated-commit-by: dots Signed-off-by: Robert Günzler --- bin/mktoes | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 bin/mktoes (limited to 'bin/mktoes') diff --git a/bin/mktoes b/bin/mktoes new file mode 100755 index 0000000..7eb47cf --- /dev/null +++ b/bin/mktoes @@ -0,0 +1,27 @@ +#!/bin/sh +set -eu +target=${1:?target} +size=${2:-normal} + +case $size in +normal) px=128 ;; +large) px=256 ;; +x-large) px=512 ;; +xx-large) px=1024 ;; +*) exit 1 ;; +esac + +md5=$(echo "file://$(readlink -e "$target")" | md5sum | cut -d' ' -f1) +dir=${XDG_CACHE_HOME:-$HOME/.cache}/thumbnails/$size +path=$dir/$md5.png +printf '%s' $path +[ -n "${MKTOES_NOGEN:-}" ] && exit 0 + +test -f $path && exit 0 +mkdir -p $dir +chmod 700 $dir + +tmp=$dir/.$$.$md5.png +ffmpeg -hide_banner -i "$target" -vf scale=$px:$px:force_original_aspect_ratio=decrease $tmp 2>/dev/null +mv -f $tmp $path +chmod 600 $path -- cgit 1.4.1