-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
dir="$1" | ||
if [ -z "$dir" ]; then | ||
echo "usage: $0 <dir>" | ||
exit | ||
fi | ||
|
||
# read all files in format of ep<episode number>_cover.png | ||
# check if ep<episode number>_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 |