Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for renaming Apple and Android videos too. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions relabel_photo_with_datetimeoriginal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ function transformDatetime {
function dateTimeFromDateTimeOriginal {
local NAME=dateTimeFromDateTimeOriginal
local FILE=$1
local DATETIME=$(exiftool -l "-EXIF:DateTimeOriginal" "$FILE" | tail -1)
if [[ $MIME == "video/quicktime" || $MIME == "video/mp4" ]]; then
local DATETIME=$(exiftool -l "-MediaCreateDate" "$FILE" | tail -1)
else
local DATETIME=$(exiftool -l "-EXIF:DateTimeOriginal" "$FILE" | tail -1)
fi
if [[ $? != 0 ]]; then
echo "$NAME(): exiftool returned $?" >&2
return
Expand Down Expand Up @@ -131,6 +135,10 @@ function processFile {
SUFFIX=".png"
elif [[ $MIME == 'image/gif' ]]; then
SUFFIX=".gif"
elif [[ $MIME == 'video/quicktime' ]]; then
SUFFIX=".mov"
elif [[ $MIME == 'video/mp4' ]]; then
SUFFIX=".mp4"
elif [[ $MIME == 'image/x-canon-cr2' ]]; then
SUFFIX=".cr2"
else
Expand All @@ -154,7 +162,7 @@ function processFile {

eval "$CMD"

local NEW="${Y}-${M}-${D}_${h}:${m}:${s}"
local NEW="${Y}${M}${D}_${h}${m}${s}"

echo "New name base: $NEW" >&2

Expand Down