Last active
August 29, 2015 14:07
-
-
Save edtjones/5963ddcd522070a34603 to your computer and use it in GitHub Desktop.
Add thumbnails (named the same as the movie) for Mov, MP4 and M4V files
This file contains hidden or 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 | |
while getopts ":t:" opt; do | |
case $opt in | |
t) | |
time=$OPTARG | |
;; | |
\?) | |
echo "Invalid option: -$OPTARG" >&2 | |
exit 1 | |
;; | |
:) | |
echo "Option -$OPTARG requires an argument." >&2 | |
exit 1 | |
;; | |
esac | |
done | |
if [ -z "$time" ]; then | |
time=10 | |
fi | |
for i in *.mov *.MOV *.m4v *.mp4; do | |
show_name=${i%.*} | |
image_name=$show_name.jpg | |
folder_name=${PWD##*/} | |
if [ ! -f "$image_name" ]; then | |
rotation=`mediainfo --Inform="Video;%Rotation%" $i`; | |
rounded_rotation=`echo $rotation | awk '{ print sprintf("%.0f", $0) }'`; | |
ffmpeg -y -ss $time -i "$i" -vframes 1 -vf "yadif,rotate='$rounded_rotation*PI/180',scale=320:-1" "$image_name" | |
atomicparsley "$i" --artwork "$image_name" --album "$folder_name" --artist "$folder_name" --TVShowName "$folder_name" --stik "TV Show" --TVEpisode "$show_name" --overWrite | |
else | |
echo "Skipping $image_name" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This generates thumbs for all the video files in the working directory.