Created
May 8, 2020 18:39
-
-
Save iemcd/81ec4cff765d9830efdd6dd574140516 to your computer and use it in GitHub Desktop.
A script to run ffmepgthumbnailer on a cron job (needs arguments supplied)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
shopt -s nocasematch | |
function thumbnail | |
{ | |
local FILE | |
for FILE in "$@" | |
do | |
# echo "$FILE" | |
# if [[ -d "$FILE" ]] | |
# then | |
# thumbnail "$FILE/*" | |
if [[ "$FILE" = *.mkv ]] || [[ "$FILE" = *.mp4 ]] || [[ "$FILE" = *.mov ]] | |
then | |
# echo "$FILE" | |
local mvname=${FILE:0:-4} | |
# echo "$mvname" | |
local imname="${mvname}.jpg" | |
# echo "$imname" | |
if ! [[ -f "$imname" ]] | |
then | |
echo "Thumbnailing $mvname" | |
ffmpegthumbnailer -i "$FILE" -o "$imname" -s 160 | |
fi | |
fi | |
done | |
} | |
thumbnail "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment