Upload the source, license will follow
This commit is contained in:
commit
8a6cc8d2f2
2 changed files with 79 additions and 0 deletions
39
massinspiro-xmas.zsh
Normal file
39
massinspiro-xmas.zsh
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "Please define how many images you wish to download"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define the output directory for the images
|
||||||
|
output_dir="./xmas_massinspiro_id_$RANDOM$RANDOM$RANDOM"
|
||||||
|
|
||||||
|
# Create the directory if it doesn't exist
|
||||||
|
mkdir -p "$output_dir"
|
||||||
|
|
||||||
|
# Loop to get and download the image 4 times
|
||||||
|
for i in {1..$1}; do
|
||||||
|
# Get the URL from the API
|
||||||
|
image_url=$(curl -s "https://inspirobot.me/api?generate=true&season=xmas")
|
||||||
|
|
||||||
|
# Check if the URL was retrieved
|
||||||
|
if [[ -z "$image_url" ]]; then
|
||||||
|
echo "Failed to get image URL for iteration $i"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define the image filename
|
||||||
|
image_filename="image_$i.jpg"
|
||||||
|
|
||||||
|
# Download the image to the specified output directory
|
||||||
|
echo "Downloading image $i from $image_url"
|
||||||
|
curl -s -o "$output_dir/$(basename $image_url)" "$image_url"
|
||||||
|
|
||||||
|
# Check if the download was successful
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo "Image $i downloaded successfully."
|
||||||
|
else
|
||||||
|
echo "Failed to download image $i."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
40
massinspiro.zsh
Normal file
40
massinspiro.zsh
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "Please define how many images you wish to download"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Define the output directory for the images
|
||||||
|
output_dir="./massinspiro_id_$RANDOM$RANDOM$RANDOM"
|
||||||
|
|
||||||
|
# Create the directory if it doesn't exist
|
||||||
|
mkdir -p "$output_dir"
|
||||||
|
|
||||||
|
# Loop to get and download the image 4 times
|
||||||
|
for i in {1..$1}; do
|
||||||
|
# Get the URL from the API
|
||||||
|
image_url=$(curl -s "https://inspirobot.me/api?generate=true")
|
||||||
|
|
||||||
|
# Check if the URL was retrieved
|
||||||
|
if [[ -z "$image_url" ]]; then
|
||||||
|
echo "Failed to get image URL for iteration $i"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define the image filename
|
||||||
|
image_filename="image_$i.jpg"
|
||||||
|
|
||||||
|
# Download the image to the specified output directory
|
||||||
|
echo "Downloading image $i from $image_url"
|
||||||
|
curl -s -o "$output_dir/$(basename $image_url)" "$image_url"
|
||||||
|
|
||||||
|
# Check if the download was successful
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo "Image $i downloaded successfully."
|
||||||
|
else
|
||||||
|
echo "Failed to download image $i."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in a new issue