Compare commits

..

8 Commits

2 changed files with 23 additions and 12 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

10
run.sh
View File

@ -51,6 +51,9 @@ fi
cd $DIR
sudo=""
if [[ -z $LOGNAME ]]; then
LOGNAME="`whoami`"
fi
if [[ $LOGNAME != "root" ]]; then
log "Using sudo since user is '$LOGNAME'."
sudo="sudo"
@ -70,7 +73,7 @@ if [[ ! `which npm` ]]; then
$sudo apt-get install -y npm
fi
if [[ ! `which curl` ]]; then
echo "- Installing NPM"
echo "- Installing Curl"
$sudo apt-get install -y curl
fi
@ -96,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
@ -109,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 ##