#!/bin/bash # 2024-01-21 Hyperling # Transition away from PhotoPrism. Helps to save system resources and downsize. ## Static Variables ## DIR=`dirname $0` a="a target='_blank' rel='noopener noreferrer'" ## Functions ## function remove_problem_strings { file="$1" sed -i -e 's/#!\/usr\/bin\/php//g' $file } # Move to the main directory. cd $DIR/.. # Where resources are from the main directory. HELPER_DIR=./pages/helpers PHOTOS_DIR=./files/photos mainpage=$PHOTOS_DIR/index.html allpage=$PHOTOS_DIR/all.html # Use the cached version if available. if [[ -e $mainpage ]]; then cat $mainpage echo "" exit 0 fi ## Start the main /photos/ page. ## function start_main_page { # Create the necessary HTML components for a web page. $HELPER_DIR/body_open.php > $mainpage sed -i -e 's/Hyperling/Hyperling: Photos/' $mainpage echo "" >> $mainpage # Give the page a description. echo -e "\t\t
You may click on an album name to " >> $mainpage echo -en "view all of its files, or click on a specific image to bring up the " >> $mainpage echo -en "full resolution. On the album pages you may also click an image or " >> $mainpage echo -e "video name to pull up the full resolution for download.
" >> $mainpage echo -e "\t\t\t`cat $photo`
" >> $mainpage else # Otherwise put in the PHOTOS page list. echo -en "\t\t\t\t`cat $photo`
" >> $subpage else echo -e "\t\t\t\t\t$filename" >> $subpage if [[ $photo == *".mp4" ]]; then echo -en " [VIDEO]" >> $subpage fi # Close the image description and its link. echo -e "
\n\t\t\t\t\n\t\t\t`cat $media_file`
" fi # Add a row if count has reset. if [[ -z $count ]]; then count=0 fi if [[ $count == 0 ]]; then echo -e "\t\t<$a href='$dir_uri'>$dir_name
" >> $allpage echo -e "\t\t\t\t<$a href='$media_uri'>$media_name
" >> $allpage echo -e "\t\t\t\t