Skip to content

Commit

Permalink
check poster size
Browse files Browse the repository at this point in the history
  • Loading branch information
Arial-Z committed Dec 19, 2022
1 parent 798db3b commit c3e4862
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions animes-renamer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ then
mal_poster_url=$(jq .data.images.jpg.large_image_url -r $SCRIPT_FOLDER/data/animes/$mal_id.json)
curl "$mal_poster_url" > $SCRIPT_FOLDER/posters/$mal_id.jpg
sleep 1.5
else
postersize=$(du -b $SCRIPT_FOLDER/posters/$mal_id.jpg | awk '{ print $1 }')
if [[ $postersize -lt 10000 ]]
then
rm $SCRIPT_FOLDER/posters/$mal_id.jpg
sleep 0.5
mal_poster_url=$(jq .data.images.jpg.large_image_url -r $SCRIPT_FOLDER/data/animes/$mal_id.json)
curl "$mal_poster_url" > $SCRIPT_FOLDER/posters/$mal_id.jpg
sleep 1.5
fi
fi
}
function get-mal-tags () {
Expand Down
10 changes: 10 additions & 0 deletions movies-renamer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ then
mal_poster_url=$(jq .data.images.jpg.large_image_url -r $SCRIPT_FOLDER/data/movies/$mal_id.json)
curl "$mal_poster_url" > $SCRIPT_FOLDER/posters/$mal_id.jpg
sleep 1.5
else
postersize=$(du -b $SCRIPT_FOLDER/posters/$mal_id.jpg | awk '{ print $1 }')
if [[ $postersize -lt 10000 ]]
then
rm $SCRIPT_FOLDER/posters/$mal_id.jpg
sleep 0.5
mal_poster_url=$(jq .data.images.jpg.large_image_url -r $SCRIPT_FOLDER/data/movies/$mal_id.json)
curl "$mal_poster_url" > $SCRIPT_FOLDER/posters/$mal_id.jpg
sleep 1.5
fi
fi
}
function get-mal-tags () {
Expand Down

0 comments on commit c3e4862

Please sign in to comment.