#!/bin/sh
#] 
#] *********************
#] $ bash "$d_bin""image crop.sh"  - photos from Irene Howell's scanned album pages
# www.BillHowell.ca  05Dec2019 initial
# 


d_albums="$d_PROJECTS""Photo Albums/"
d_cropp="cropped/"
p_albumList="$d_temp""album_flist.txt"


#*********************
# file lists
# ls -1 "/run/media/bill/PROJECTS/Photo Albums/"

Field_Separator=$IFS
IFS=!

fList_all=(
"1948-65 Irene-Neil in the beginning"
"1954 Neil Howell, business"
"1966-72 Australia, Israel"
"1973-77 Canyon Meadows"
"1978-82 Comox"
"1983-87 Comox"
"1986-96 Cancun"
"1988-90 Comox"
"1991-92 Comox"
"1993 Comox"
"1994-96 Summerland"
"1995 MISC PHOTOS"
"1997 Summerland, Calgary"
"2000 on, Calgary"
"WEDDING Catherine Howell & James Pemberton"
"WEDDING Donna Howell & Chritian Sarazzin"
"WEDDING Bill Howell & Denise Tremblay"
"WEDDING Neil Howell & Irene Walaker, others"
"WEDDING Steve Howell & Diane Byers"
"WEDDINGS Others"
)


# test - from https://linuxhint.com/bash_loop_list_strings/
# for val2 in ${fList_all[*]}; do
# 	echo $val2
# done 


fList_todo=(
)

fList_action=(
"1948-65 Irene-Neil in the beginning"
"1954 Neil Howell, business"
"1966-72 Australia, Israel"
"1973-77 Canyon Meadows"
"1978-82 Comox"
"1983-87 Comox"
"1986-96 Cancun"
"1988-90 Comox"
"1991-92 Comox"
"1993 Comox"
"1994-96 Summerland"
"1995 MISC PHOTOS"
"1997 Summerland, Calgary"
"2000 on, Calgary"
"WEDDING Catherine Howell & James Pemberton"
"WEDDING Donna Howell & Chritian Sarazzin"
"WEDDING Bill Howell & Denise Tremblay"
"WEDDING Neil Howell & Irene Walaker, others"
"WEDDING Steve Howell & Diane Byers"
"WEDDINGS Others"
)


#******************


#] albums_fList()  - 

	albums_fList()
{
for album in ${fList_action[*]}; do
	ls -1 "$d_albums$album"  |  grep --invert-match "cropped"  |  sed  's#^#"#'  |  sed  's#$#"  "<change title>.jpg"#'  >>"$d_temp""fList $album.txt"
done 
} 

# first, in terminal that will run the maccro :
# d_albums="/run/media/bill/PROJECTS/Photo Albums"

#] album_pages_rename()  - 

	album_pages_rename()
{
bash "$d_albums/""fList $1.txt"
for album in ${fList_action[*]}; do
	mv "$d_albums$album"  |  grep --invert-match "cropped"  |  sed  's#$#"  "<change title>.jpg"#'  >>"$d_temp""fList $album.txt"
done 
}



#**********************
# photo extractions

#] 25_by_25()  - 

	25_by_25()
{
imgSizLoc_1="3680x3680+450+550"
imgSizLoc_2="3680x3680+450+4610"
imgSizLoc_3="3680x3680+450+8575"
imgSizLoc_4="3680x3680+4730+550"
imgSizLoc_5="3680x3680+4730+4610"
imgSizLoc_6="3680x3680+4730+8575"
}


#] crop_it()  - 

	crop_it()
{
convert  "$d_photo$d_album""$1"  -crop  "$imgSizLoc_1"  "$d_photo$d_album$d_cropp""$2"" 1.jpg"
convert  "$d_photo$d_album""$1"  -crop  "$imgSizLoc_2"  "$d_photo$d_album$d_cropp""$2"" 2.jpg"
convert  "$d_photo$d_album""$1"  -crop  "$imgSizLoc_3"  "$d_photo$d_album$d_cropp""$2"" 3.jpg"
convert  "$d_photo$d_album""$1"  -crop  "$imgSizLoc_4"  "$d_photo$d_album$d_cropp""$2"" 4.jpg"
convert  "$d_photo$d_album""$1"  -crop  "$imgSizLoc_5"  "$d_photo$d_album$d_cropp""$2"" 5.jpg"
convert  "$d_photo$d_album""$1"  -crop  "$imgSizLoc_6"  "$d_photo$d_album$d_cropp""$2"" 6.jpg"
}


#] photos_done()  - 

	photos_done()
{
crop_it "scan20190420_13375189.jpg"  "1966-67 Queensland Sunshine Coast"
crop_it "scan20190421_16572741.jpg"  "1968-69 Willow Pk house"
}


#] photos_todo()  - 

	photos_todo()
{  
d_album="$1"
}


#**********************
# Runs

25_by_25

 albums_fList
#albums_rename 
#photos_todo"





# $ bash "$d_bin""image crop.sh"


# enddoc
