File: tagpix/examples/AUTOMATED-INPUTS/tagpix-merge.sh

#!/bin/bash
#====================================================================
# Full tagpix.py run - merge photos from New-unmerged/ to MERGED/.
#
# Edit path settings, and run this with: 'bash tagpix-merge.sh'.
# Automates console inputs with an in-script bash 'here' document
# (<<-EOF ...tabbed lines... EOF), and omits prompts (2> /dev/null).
#
# The latter works here only because tagpix uses a custom input().
# Python's standard input() prompts to stdout (usually: it's a bug).
# Nit: 2> redirects may also discard error messages; use with care.
#====================================================================

# folder with MERGED/ and New-unmerged/ subfolders
images=~/MY-STUFF/Camera/Digital-cameras-merged

# folder where tagpix.py is installed 
tagpix=~/MY-STUFF/Code/tagpix

# verify run
read -p 'Are you sure (y or n)? ' reply
if [ -z $reply ] || [ $reply != 'y' ]; then echo 'No changes made.'; exit; fi

cd $images
python3 $tagpix/tagpix.py 2> /dev/null <<-EOF
	y
	New-unmerged
	.
	y
	n
	n
	n
	n
	EOF



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