-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_exiftool
224 lines (209 loc) · 9.13 KB
/
_exiftool
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#compdef exiftool
# exiftool-zsh-completion (C) by Henrik Lindgren henrikprojekt@gmail.com
#
# It is free software; you can redistribute it and/or modify it under the terms of either:
#
# a) the GNU General Public License as published by the Free Software Foundation;
# either external linkversion 1, or (at your option) any later versionexternal link, or
#
# b) the "Artistic License".
_exif_tool_c () {
# dont alter global scoped completion variables
# local curcontext="$curcontext" state line state_descr
# typeset -A opt_args
# function specific variables
local -a exif_charset exif_family exif_lang list_arguments exif_listx exif_overwrite exif_writemode
exif_writemode=(
'c:Create new tags'
'g:create new Groups as necessary'
'w:Write existing tags'
)
exif_listx=(
'-f:add flags attribute'
'-s:shorten output omit description and values'
)
exif_list=(
'-EXIF\:All:list all Exif tags'
'-XMP\:All:list all xmp tags'
'-gps\:'
)
charset=(
'Arabic:cp1256 Windows Arabic'
'Baltic:cp1257 Windows Baltic'
'Cyrillic:cp1251,Russian Windows Cyrillic'
'Greek:cp1253 Windows Greek'
'Hebrew:cp1255 Windows Hebrew'
'Latin2:cp1250 Windows Latin2 (Central European)'
'Latin:cp1252, Latin1 Windows Latin1 (West European)'
'MacCroatian:cp10082 Macintosh Croatian'
'MacCyrillic:cp10007 Macintosh Cyrillic'
'MacGreek:cp10006 Macintosh Greek'
'MacIceland:cp10079 Macintosh Icelandic'
'MacLatin2:cp10029 Macintosh Latin2 (Central Europe)'
'MacRoman:cp10000, Roman Macintosh Roman'
'MacRomanian:cp10010 Macintosh Romanian'
'MacTurkish:cp10081 Macintosh Turkish'
'Thai:cp874 Windows Thai'
'Turkish:cp1254 Windows Turkish'
'UTF8:cp65001, UTF-8 UTF-8 characters (default)'
'Vietnam:cp1258 Windows Vietnamese'
)
exif_family=(
'0:Information Type'
'1:Specific Location'
'2:Category'
'3:Document Number'
'4:Instance Number'
)
exif_lang=(
'cs:Czech (Čeština)'
'de:German (Deutsch)'
'en-ca:Canadian English'
'en-gb:British English'
'en:English'
'es:Spanish (Español)'
'fi:Finnish (Suomi)'
'fr:French (Français)'
'it:Italian (Italiano)'
'ja:Japanese (日本語)'
'ko:Korean (한국어)'
'nl:Dutch (Nederlands)'
'pl:Polish (Polski)'
'ru:Russian (Русский)'
'sv:Swedish (Svenska)'
'tr:Turkish (Türkçe)'
'zh-cn:Simplified Chinese (简体中文)'
'zh-tw:Traditional Chinese (繁體中文)'
)
exif_overwrite=(
'!:overwrite existing file'
'+:append to existing file'
)
# -A -n
# '---[exclude TAG]:exclude tag:->tags'\
_arguments '-[TAG\[+|-|=<\]]'\
'-csv[Export/import tags in CSV format]'\
'-fast-[Increase speed of extracting information from JPEG images]:arg:((\
2\:"avoid extracting any EXIF MakerNote information"\
3\:"avoid processing file, return initial guess at FileType"\
))'\
'-if[evaluate condition before processing each FILE]'\
'-charset[Specify encoding for special characters]:charset:{_describe 'values' exif_charset}'\
'-listg-[list all groups in family nr]:family:{_describe 'fam' exif_family}'\
'(-i -ignore)'{-i,-ignore}"[Ignore specified directory name]:directory:_directories"\
'(-v- -verbose-)'{-v-,-verbose-}'[Print verbose messages]:nr:(0 1 2 3 4 5)'\
'-wm[Set mode for writing/creating tags]:writemode:{_describe 'values' exif_writemode}'\
'-@[Read arguments from file]:filename:_files'\
'-config[Specify configuration file name]:file:_files'\
'(-W- -tagOut-)'{-W-,-tagOut-}'[Output to text file for each tag]:argument:{_describe 'values' exif_overwrite}'\
'(-w- -textOut-)'{-w-,-textOut-}'[Output console to EXT files]:argument:{_describe 'values' exif_overwrite}'\
'(-s- -short-)'{-s-,-short-}'[Short output format]:shortarguments:((\
1\:"print tag names instead of descriptions"\
2\:"no extra spaces to column-align values"\
3\:"print values only no tag names"\
))'\
'(-o -out)'{-o,-out}'[OUTFILE may be "-" for stdout]:filename:_files'\
'-echo-[Echo text to stdout or stderr]:nr:(1 2)'\
'(-U -unknown2)'{-U,-unknown2}'[Extract unknown tags and unknown binary information]'\
'(-z -zip)'{-z,-zip}'[Extract .gz .bz2 compressed images]'\
'(-k -pause)'{-k,-pause}'[Pause with message]'\
'(-n --printConv)'{-n,--printConv}'[Read/write numerical tag values]'\
'(-p -printFormat)'{-p,-printFormat}'[Print output in specified format]'\
'(-args -argFormat)'{-args,-argFormat}'[Format metadata as exiftool arguments]'\
'-b[Output metadata in binary format]'\
'-c[Set format for GPS coordinates]'\
'-d[Set format for date/time values]'\
'-D[Show tag ID numbers in decimal]'\
'-E[excmd]'\
'-f[Force printing of all specified tags]'\
'(-g -groupHeadings)'{-g,-groupHeadings}'[Organize output by tag group]'\
'(-G -groupNames)'{-G,-groupNames}'[Print group name for each tag]'\
'(-h -htmlForat)'{-h,-htmlForat}'[Use HMTL formatting for output]'\
'(-H -hex)'{-H,-hex}'[Show tag ID number in hexadecimal]'\
'-htmlDump[Generate HTML-format binary dump]'\
'(-csv)-j[Export/import tags in JSON format]'\
'-l[Use long 2-line output format]'\
'-lang[Set current language]:lang:{_describe 'values' exif_lang}'\
'-L[Use Windows Latin1 encoding]'\
'-php[Export tags as a PHP Array]'\
'-S[Very short output format]'\
'(-sep -separator)'{-sep,-separator}'[Separator string for list items]:list separator:'\
'(-sort --sort)'{-sort,--sort}'[Sort output alphabetically]'\
'(-struct --struct)'{-struct,--struct}'[Output structured XMP information]'\
'(-T -table -t -tab -X)'{-t,-tab}'[Output in tab-delimited list format]'\
'(-T -table -t -tab -X)'{-T,-table}'[Output tag values in table form. Equivalent to -t -S -q -f]'\
'-W-[Write only specified file types with -W]:extension:'\
'(-T -table -t -tab -X)-X[Use RDF/XML output format]'\
'-k[Pause before terminating]'\
'(- 1 :)-ver[Print exiftool version number]'\
'-geotag[Geotag images from specified GPS log]:log:_files'\
'-globalTimeShift[Shift all formatted date/time values]'\
'-listItem[Extract specific item with nr from a list]'\
'-list[list all tag names]:listargs:->tagGroups'\
'-listd[list all deletable groups]'\
'-listf[list all supported file extensions]'\
'-listr[list all recognized file extensions]'\
'-listw[list all writable tags]'\
'-listwf[list all writable file extensions]'\
'-listx[list database of specified tags in XML format]:listargs:{_describe 'values' exif_list -- exif_listx }'\
'-use[Add features from plug-in module]:module:'\
'(-r -recurse)'{-r,-recurse}'[Recursively process subdirectories]'\
'(-m -ignoreMinorErrors)'{-m,-ignoreMinorErrors}'[Ignore minor errors and warnings]'\
'(-P -preserve)'{-P,-preserve}'[Preserve date/time of original file]'\
'-progress[Show file progress count]'\
'-scanForXMP[Brute force XMP scan]'\
'-overwrite_original[Overwrite original by renaming tmp file]'\
'-overwrite_original_in_place[Overwrite original by copying tmp file]'\
'-password[Password for processing protected files]:password:'\
'(-e --composite)'{-e,--composite}'[Do not calculate composite tags]'\
'(-ee -extractEmbedded)'{-ee,-extractEmbedded}'[Extract information from embedded files]'\
'(-ext -extension)'{-ext,-extension}'[Process files with specified extension]:extension:'\
'--ext[Process files without specified extension]:extension:'\
'(-F -fixBase)'{-F,-fixBase}'[Fix the base for maker notes offsets]'\
'(-m -ignoreMinorErrors)'{-m,-ignoreMinorErrors}'[Ignore minor errors and warnings]'\
'-fileOrder[Set file processing order]'\
'(-a -duplicates)'{-a,-duplicates}'[Allow duplicate tag names extraction]'\
'(--a --duplicates)'{--a,--duplicates}'[Suppress duplicate tag name extraction]'\
'-delete_original[Delete "_original" backups]'\
'-restore_original[Restore from "_original" backups]'\
'-api[Set ExifTool API option]'\
'-common_args[Define common arguments]'\
'-execute[Execute multiple commands on one line]'\
'-srcfile[Set different source file name]:source filename:_files'\
'-stay_open[Keep reading -@ argfile even after EOF]'\
{-x,-exclude}'[Exclude specified tag]:exclude tag:'\
'-userParam[Set user parameter (API UserParam opt)]'\
'-tagsFromFile[Copy tag values from file]:source filename:_files'\
'*:file containing exif data:->exifdata' && return 0
case $state in
tagGroups )
local -a taggroup
local re_taggroups
taggroup=( ${${(@f)$( exiftool -listg0 -listg1 -listg2 -listg3 -listg4 )}//Groups in family [0-9]:/} )
# [[ -regex-match ^a([^a]+)a([^a]+)a ]] &&
# print -l $MATCH X $match
# taggroup=($(call_program exiftool -listg0 -listg1 -listg2 -listg3 -listg4 | grep -oP '(?!.*[:])[a-zA-Z0-9-_#]+'))
compadd -S ":" -P "-" -X 'TagGroups' -a $taggroup
return 0
;;
exifdata)
local exif_args exif_file
for string in $words[@]; do
[[ -f "$string" ]] && exif_file+=( "$string" )
done
[[ ! -z $exif_file[@] ]] && \
exif_args=( ${${(@fq)"$( exiftool -argFormat $exif_file[@] 2>/dev/null )"}//:/\\:})
if [[ -z $exif_args[@] ]]; then
_files
else
_alternative ':exiftags:{ _describe "exif tags" exif_args }' ':files:_files'
fi
# compadd -X "exif tags in file: $exif_file[1]" -a exif_args
return 0
;;
esac
return 1
}
_exif_tool_c "$@" && return 0
return 1
# vim: set ts=2 sw=2 tw=0 foldenable foldmethod=syntax foldclose=all nowrap :