forked from kaytat/exiftool-scripts-for-takeout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathburst.args
57 lines (46 loc) · 1.84 KB
/
burst.args
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Use filename as the date
# Look at all media files and ignore JSON
--ext
json
# Recursive
-r
# Show processed filenames
-v0
# Attempt to modify media only if the info doesn't already exist
-if
($Filetype eq "MP4" and not $quicktime:TrackCreateDate) or ($Filetype eq "MP4" and $quicktime:TrackCreateDate eq "0000:00:00 00:00:00") or ($Filetype eq "JPEG" and not $exif:DateTimeOriginal) or ($Filetype eq "PNG" and not $PNG:CreationTime)
# Look for a filename that looks like an image made from a burst capture.
#
# Example: 00000IMG_00000_BURST20180901101751159_COVER.jpg
#
# The logic is:
# anything
* _BURST
# sequence of 17 numbers (this is meant to be YYYYMMDD and then HHMMSSmmm)
# anything that's not a number (to get to the .extension)
-if
$Filename =~ /.*_BURST[0-9]{17}.*/
# Sanity check year equal or less than the current year
-if
(${Filename;s/.*_BURST([0-9]{4}).*/$1/}) <= ${now;s/^([0-9]{4}).*/$1/}
#
# Write out the tags. Extract the YYYYMMDDHHMMSSmmm date from the filename and
# feed it into the various date/time tags. Although not strictly the
# 'YYYY:MM:DD HH:MM:SS' format expected by exiftool, the tools seems smart
# enough to handle anything that looks close to a legitimate date/time.
#
# Although the milliseconds are parsed, I'm not sure that level of
# granularity is captured in the tags.
#
# EXIF for regular JPEG photos
-AllDates<${filename;s/.*_BURST([0-9]{17}).*/$1/}
# PNG-specific
-XMP-Exif:DateTimeOriginal<${filename;s/.*_BURST([0-9]{17}).*/$1/}
-PNG:CreationTime<${filename;s/.*_BURST([0-9]{17}).*/$1/}
# Quicktime / MP4
-QuickTime:TrackCreateDate<${filename;s/.*_BURST([0-9]{17}).*/$1/}
-QuickTime:TrackModifyDate<${filename;s/.*_BURST([0-9]{17}).*/$1/}
-QuickTime:MediaCreateDate<${filename;s/.*_BURST([0-9]{17}).*/$1/}
-QuickTime:MediaModifyDate<${filename;s/.*_BURST([0-9]{17}).*/$1/}
# Clobber everything
-overwrite_original