Commit 44764217 authored by Henry Kautz's avatar Henry Kautz

Updated script to handle end of month

parent 865134b4
Now that you have used Super Apple Photos Export to export your Apple Photos album, you may want to upload them to Google Photos. However: Google Photos organizes photos in albums by date - there is no option for organizing photos alphabetically by file name - so many of your beautiful albums will become disorganized! Mass Change Photo Dates is a command line script that processes one or more folders at a time, and changes the timestamps so that the increasing order of time matches the the alphabetic order of file names. After processing, upload the contents of your folder to Google Photos, recreate the album from the "last uploaded" set of photos, and set the album sort to "date" rather than "upload order". The script handles the oddities of how Google Photo determines timestamps and timezones, which is no at all what you might expect. Requires the free program
exiftool
exiftool.
......@@ -8,14 +8,13 @@ files in the directory in alphabetical order to have dates
in increasing order starting from noon on the extracted starting
date. First image is set to 6:00am. Dates increase by 60 seconds
for each image file. These numbers can be edited in the script.
Script fails if incrementing the time runs over the end of the
month. Option -city specifies a city used to set the GPS location
Option -city specifies a city used to set the GPS location
and time zone. The GPS location is only set for files that do
not have a GPS tag.'
exit 1
fi
(( STARTTIME = 6 )) # time used for first photo in directory
(( STARTTIME = 6 )) # hour used for first photo in directory
(( INCREMENT = 60 )) # increase in seconds between photos, maximum value 60
CITY=''
......@@ -26,6 +25,7 @@ if [[ ${1} == '-city' ]]; then
CITY=${1}
shift;
# convert city name to GPS latitude and longitude
# Google actually ignores TIMEZONE, and uses the lat/long to compute timezone
case "${CITY}" in
london )
# The N and W are ignored, they actuall come from the Ref tags
......@@ -93,7 +93,7 @@ while (( $# > 0)); do
echo ">> setting date to ${YEAR}:${MONTH}:${DAY} ${FHOUR}:${FMIN}:${FSEC} for ${f}"
# Google Photos cares about the DateCreated and TimeCreated fields
# Google Photos only cares about the DateCreated and TimeCreated fields, but we'll set them all
exiftool -q "-AllDates=${YEAR}:${MONTH}:${FDAY} ${FHOUR}:${FMIN}:${FSEC}" "-DateCreated=${YEAR}:${MONTH}${FDAY}" "-TimeCreated=${FHOUR}:${FMIN}:${FSEC}${TIMEZONE}" "-DigitalCreationTime=${FHOUR}:${FMIN}:${FSEC}${TIMEZONE}" "-DigitalCreationDate=${YEAR}:${MONTH}${FDAY}" "${f}"
# Check if GPS should be modified
......@@ -113,6 +113,15 @@ while (( $# > 0)); do
if (( HOUR > 23 )); then
(( HOUR = 0 ))
(( DAY = DAY + 1 ))
# Sloppy month increment, since all we care about is order
if (( DAY > 27 )); then
(( MONTH = MONTH + 1 ))
(( DAY = 1 ))
if (( MONTH > 12 )); then
(( YEAR = YEAR + 1 ))
(( MONTH = 1 ))
fi
fi
fi
fi
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment