Updated rtexif using ExifTool-10.78, closes #4371

This commit is contained in:
Morgan Hardwood
2018-02-06 01:10:11 +01:00
parent 21f27e1f21
commit 12025f2851
6 changed files with 114 additions and 67 deletions

View File

@@ -29,30 +29,58 @@ fi
mkdir -p "$tmpdir" || { printf '%s\n' "Error creating $tmpdir" ""; exit 1; }
echo
#------------------------------------------------------------------------------
# Canon
printf '%s\n' "Saving ${tmpdir}/canon_lenses"
xmlstarlet sel -T -t -m "taginfo/table/tag[@name='LensType']/values/key" -v "concat(@id,' ',val)" -n < <("$et" -listx -canon:all) | sort -fuV > "${tmpdir}/canon_lenses"
sed -r -i -e '/-1\tn\/a/d' -e 's/([0-9]+)[0-9.]*\t/\1, "/' -e 's/^/ choices.insert (p_t (/' -e 's/$/"));/' -e 's| F/([0-9]+)| f/\1|' "${tmpdir}/canon_lenses"
# xmlstarlet sel -T -t -m "taginfo/table/tag[@name='EasyMode']/values/key" -v "concat(@id,' ',val)" -n < <(exiftool -listx -canon:all) | sed -r -e '/-1\tn\/a/d' -e 's/([0-9]+)[0-9.]*\t/\1] = "/' -e 's/^/ choices[/' -e 's/$/";/'
#In :10.1 Sigma 50mm f/2.8 EX
#Out: {10, "Sigma 50mm f/2.8 EX"},
# delete lines matching '-1<tab>n/a'
# replace '10.1<tab>Sigma' with '10, "Sigma'
# prepend whitespace
# append closing braces
# replace ' F/11' with ' f/11'
sed -r -i \
-e '/-1\tn\/a/d' \
-e 's/([0-9]+)[0-9.]*\t/\1, "/' \
-e 's/^/ {/' \
-e 's/$/"},/' \
-e 's| F/([0-9]+)| f/\1|' \
"${tmpdir}/canon_lenses"
#In :16842752 PowerShot A30
#Out: choices[16842752] = "PowerShot A30";
# prepend whitespace and 'choices['
# replace <tab> with '] = "'
# append '";'
printf '%s\n' "Saving ${tmpdir}/canon_cameras"
xmlstarlet sel -T -t -m "taginfo/table/tag[@name='CanonModelID']/values/key" -v "concat(@id,' ',val)" -n < <("$et" -listx -canon:all) | sort -fuV > "${tmpdir}/canon_cameras"
sed -r -i -e 's/^/ choices[/' -e 's/\t/] = "/' -e 's/$/";/' "${tmpdir}/canon_cameras"
sed -r -i \
-e 's/^/ choices[/' \
-e 's/\t/] = "/' \
-e 's/$/";/' \
"${tmpdir}/canon_cameras"
#------------------------------------------------------------------------------
# Nikon LensIDs are composite tags
printf '%s\n' "Saving ${tmpdir}/nikon"
xmlstarlet sel -T -t -m "taginfo/table/tag[@name='LensID']/values/key" -v "concat(@id,' ',val)" -n < <("$et" -listx -composite:all) > "${tmpdir}/nikon"
sed -r -i -e '/^... /d' -e 's/^/ {"/' -e 's/([A-F0-9]+)[A-F0-9.]*\t/\1", "/' -e 's/$/"},/' -e 's|(.* ")(.*) F([0-9]+)|\1\2 f/\3|' -e 's| F/([0-9]+)| f/\1|' "${tmpdir}/nikon"
#------------------------------------------------------------------------------
# Olympus
printf '%s\n' "Saving ${tmpdir}/olympus"
xmlstarlet sel -T -t -m "taginfo/table/tag[@name='LensType']/values/key" -v "concat(@id,' ',val)" -n < <("$et" -listx -olympus:all) | sort -fuV > "${tmpdir}/olympus"
sed -r -i -e '/0 00 00\tNone/d' -e 's/^/ lenses["0/' -e 's/\t/"] = "/' -e 's/$/";/' -e 's| F([0-9]+)| f/\1|g' "${tmpdir}/olympus"
#------------------------------------------------------------------------------
# Pentax
printf '%s\n' "Saving ${tmpdir}/pentax"
xmlstarlet sel -T -t -m "taginfo/table/tag[@name='LensType']/values/key" -v "concat(@id,' ',val)" -n < <("$et" -listx -pentax:all) | sort -fuV > "${tmpdir}/pentax"
sed -r -i -e 's/^/ choices.insert (p_t (256 * /' -e 's/([0-9]+) ([0-9]+)([0-9.]*)/\1 + \2/' -e 's/\t/, "/' -e 's/$/"));/' -e 's| F([0-9]+)| f/\1|' "${tmpdir}/pentax"
#------------------------------------------------------------------------------
# Sony
printf '%s\n' "Saving ${tmpdir}/sony"
xmlstarlet sel -T -t -m "taginfo/table/tag[@name='LensType']/values/key" -v "concat(@id,' ',val)" -n < <("$et" -listx -sony:all) | sort -fuV > "${tmpdir}/sony"