From 0e4535e846717e71efebdff93bd3728b4fc959d2 Mon Sep 17 00:00:00 2001 From: Wolfgang Gassler Date: Mon, 28 Aug 2023 21:02:43 +0200 Subject: [PATCH] create small cover images --- automate/covers.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 automate/covers.sh diff --git a/automate/covers.sh b/automate/covers.sh new file mode 100755 index 0000000..364e293 --- /dev/null +++ b/automate/covers.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +dir="$1" +if [ -z "$dir" ]; then + echo "usage: $0 " + exit +fi + +# read all files in format of ep_cover.png +# check if ep_cover_small.png exists +# otherwise create it by resizing to 1500x1500 + +for file in "$dir"/ep*_cover.png +do + echo "checking $file" + if [ ! -f "$file" ]; then + echo "skipping $file as it doesn't exist" + continue + fi + # get the episode number + episode_number=$(echo "$file" | sed -e 's/.*ep\([0-9]*\)_cover.png/\1/') + echo "episode number: $episode_number" + # check if the small cover exists + if [ -f "$dir/ep${episode_number}_cover_small.png" ]; then + echo "skipping $file as small cover already exists" + continue + fi + # resize the cover to 1500x1500 + echo "resizing $file to 1500x1500" + convert "$file" -resize 1500x1500 "$dir/ep${episode_number}_cover_small.png" +done \ No newline at end of file