Compare commits

..

6 Commits

2 changed files with 19 additions and 11 deletions

View File

@ -131,13 +131,15 @@ function build_album_pages {
fi
## Put in the subpage HTML ##
# Set the count if this is the first loop.
new_row="\t\t<div class='row text'>"
# Set the count and start a row if this is the first loop.
if [[ -z $count ]]; then
count=0
fi
# Add a row for the next 2 images.
if (( $count % 2 == 0 )); then
echo -e "\t\t<div class='row text'>" >> $subpage
echo -e "$newrow" >> $subpage
# Else check if we need to start a new one for the next 2 images.
elif (( $count % 2 == 0 )); then
echo -e "\t\t</div>" >> $subpage
echo -e "$newrow" >> $subpage
fi
# Add the container for the image and its text.
echo -e "\t\t\t<div class='col-6 center'>" >> $subpage
@ -160,10 +162,6 @@ function build_album_pages {
fi
# Close the image description and its link.
echo -e "</p>\n\t\t\t\t</a>\n\t\t\t</div>" >> $subpage
# Close the row after an odd count.
if (( $count % 2 == 1 )); then
echo -e "\t\t</div>" >> $subpage
fi
count=$(( count + 1 ))
done
echo -e "\t\t</div>" >> $subpage
@ -249,7 +247,8 @@ function build_all_page {
count=0
fi
if [[ $count == 0 ]]; then
echo -e "\t\t<div class=row text>" >> $allpage
echo -e "\t\t</div>" >> $allpage
echo -e "\t\t<div class='row text'>" >> $allpage
fi
# Add a column.
@ -291,10 +290,16 @@ function build_all_page {
}
## Main ##
beg_time="$SECONDS"
start_main_page
build_album_pages
build_all_page
end_main_page
end_time="$SECONDS"
time="$(( $end_time - $beg_time ))"
echo "<!-- Script took '$time' seconds to process. -->" >> $mainpage
cat $mainpage
exit 0

5
run.sh
View File

@ -99,6 +99,7 @@ find files/photos/ -name "*".html -print -delete
http_code=0
port="${ports%% *}"
photos_uri=":$port/photos/"
beg_time="$SECONDS"
while [[ $http_code != "200" ]]; do
log "Sleeping for '$count' while waiting for $photos_uri to come up."
sleep $count
@ -112,7 +113,9 @@ find files/photos/ -name "*".html -print -delete
count=$(( count + 1 ))
fi
done
log "Finished checking for /photos/."
end_time="$SECONDS"
time="$(( $end_time - $beg_time ))"
log "Finished checking for /photos/ after '$time' seconds."
} &
## Main ##