File: site-mobile-screenshots/_publish.sh

#===================================================================
# Automatically build+publish this folder's content, only.
#
# Launch this script from Terminal in its own folder, with:
#     cd $W/Posts/Current/Complete/site-mobile-screenshots
#     bash _publish.sh
#
# Also run by $W/_admin/BUILD-THUMBSPAGE-CLIENTS/_PUBLISH.sh, to 
# update all thumbspage external clients in a single step.
#
# Update: as of 2.2, this script could use setting=value config arguments
# in its thumbspage command line, instead of editing the config file with 
# a sed command.  For example:
#
#     py3 $C/thumbspage/thumbspage.py . \
#                 thumbsBgColor=\'#123456\' \
#                 thumbsFgColor=\'white\' ...etc... <<-EOF
#
# Update: as of 2.3, this script can be run without config edits too
# (viewer Bg and Border are white by default and so need not be set,
# but we have to set thumbs Border only here, because it won't default 
# to the thumbs Fg as an arg like it does in the edited config file):
#
#     py3 $C/thumbspage/thumbspage.py . \
#         inputCleanThumbsFolder=True inputThumbsPerRow=3 \
#         inputThumbMaxSize=100,100 inputUseViewerPages=True \
#         thumbsBgColor=\'#123456\' thumbsFgColor=\'white\' thumbsBorderColor=\'white\'
#         viewerBgColor=\'#123456\'
#
# This also makes the file save/restore unnecessary.  See also tp's
# examples/2.2-upgrades/config-args-demo.sh for a complete demo.
#===================================================================

# get common defs
source ~/MY-STUFF/Websites/_admin/BUILD-THUMBSPAGE-CLIENTS/common.sh

# save zip to $C/thumbspage/_private?
SaveInTP=y

# save configs file for edits
mv $C/thumbspage/user_configs.py $C/thumbspage/user_configs.py.bkp

# edit configs
sed -e "s/thumbsBgColor = 'lightgrey'/thumbsBgColor = '#123456'/" \
    -e "s/thumbsFgColor = 'black'/thumbsFgColor = 'white'/" \
    -e "s/viewerBgColor = 'black'/viewerBgColor = '#123456'/" \
	< $C/thumbspage/user_configs.py.bkp > $C/thumbspage/user_configs.py

# build gallery
py3 $C/thumbspage/thumbspage.py . <<-EOF
	
	3
	
	
	EOF

# restore configs asap
mv $C/thumbspage/user_configs.py.bkp $C/thumbspage/user_configs.py

# in index.html, not in viewable HEADER.html
py3 $M/insert-analytics.py index.html

cd $W
py3 _PUBLISH.py | tail -n 20

cd UNION
py3 $Z/zip-create.py site-mobile-screenshots.zip site-mobile-screenshots \
        -skipcruft | tail -n 20

SCP site-mobile-screenshots.zip htdocs
SSH <<-EOF
	cd htdocs
	rm -rf site-mobile-screenshots/
	unzip -d . site-mobile-screenshots.zip
	rm site-mobile-screenshots.zip
	exit
	EOF

if [ $SaveInTP == 'y' ]
then
    mv site-mobile-screenshots.zip $C/thumbspage/_private/site-mobile-screenshots--$stamp.zip
else
    rm site-mobile-screenshots.zip
fi



[Home page] Books Code Blog Python Author Train Find ©M.Lutz