Output of -PV was not suitable for inputting to -m-, key was missing. (#1970)

* Output of -PV was not suitable for inputting to -m-, key was missing.

Fix #1969

* Make V flag to -P also print the type

This makes -PV work also for non-built-in tags (of which their type is
not known by exiv2).

* Adjust man to accomodate for the V flag change
This commit is contained in:
Facundo 2021-12-29 17:19:23 +01:00 committed by GitHub
parent c28e501b91
commit b52b6db39f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 10 deletions

View File

@ -40,7 +40,7 @@ set Xmp.dc.creator XmpSeq "1) The first creator"
set Xmp.dc.creator "2) The second creator"
set Xmp.dc.creator "3) And another one"
# A language alternative. The default entry of a langauge alternative
# A language alternative. The default entry of a language alternative
# doesn't need a language qualifier.
set Xmp.dc.description LangAlt lang=de-DE Hallo, Welt
set Xmp.dc.description LangAlt Hello, World

View File

@ -571,7 +571,7 @@ as well as data columns included in the print output. Valid flags are:
| c | Number of components (for single entry types, the number of **sizeof('type')** in 'size'. For multi-entry types, the number of entries. See [Exif/IPTC/XMP types](#exiv2_types)) |
| s | Size in bytes of vanilla output (see note in [Exif 'Comment' values](#exif_comment_values)). Some types include a *NULL* character in the size (see [Exif/IPTC/XMP types](#exiv2_types)) |
| v | Plain data value (vanilla values, i.e., untranslated) |
| V | Plain data value and the word 'set ' (see ['MODIFY' COMMANDS](#modify_cmds))|
| V | Plain data value, data type and the word 'set ' (see ['MODIFY' COMMANDS](#modify_cmds))|
| t | Interpreted (translated) human-readable data values (includes plain vanilla values) |
| h | Hex dump of the data |
@ -1292,10 +1292,10 @@ $ exiv2 --Modify "set Iptc.Application2.Caption Stonehenge" --modify cmdfile.txt
<div id="gen_modify_cmds">
A list of modify commands can be generated from an existing file using
[--Print Vkyv](#Print_flgs). For example, only displaying the 'dc'
[--Print V](#Print_flgs). For example, only displaying the 'dc'
'modify' commands:
```
$ exiv2 --Print Vkyv --grep dc Stonehenge.jpg
$ exiv2 --Print V --grep dc Stonehenge.jpg
set Xmp.dc.description LangAlt lang="x-default" Classic View
set Xmp.dc.Family XmpBag Robin
```

View File

@ -720,7 +720,7 @@ int Params::evalPrintFlags(const std::string& optArg)
printItems_ |= prHex;
break;
case 'V':
printItems_ |= prSet | prValue;
printItems_ |= prSet | prKey | prType | prValue;
break;
default:
std::cerr << progname() << ": " << _("Unrecognized print item") << " `" << i << "'\n";

View File

@ -40,7 +40,7 @@ set Xmp.dc.creator XmpSeq "1) The first creator"
set Xmp.dc.creator "2) The second creator"
set Xmp.dc.creator "3) And another one"
# A language alternative. The default entry of a langauge alternative
# A language alternative. The default entry of a language alternative
# doesn't need a language qualifier.
set Xmp.dc.description LangAlt lang=de-DE Hallo, Welt
set Xmp.dc.description LangAlt Hello, World

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestPrintPlainWithSet(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/1969"
filename = "$data_path/smiley1.jpg"
commands = ["$exiv2 -K Exif.Image.ImageDescription -PV $filename"]
stdout = [
"""set Exif.Image.ImageDescription Ascii Well it is a smiley that happens to be green
"""
]
retval = [0]

View File

@ -18,10 +18,10 @@ class MetadataPiping(metaclass=system_tests.CaseMeta):
"""$exiv2 -pa --grep GPSL $filename"""
]
output_grep_GPSL = """set Exif.GPSInfo.GPSLatitudeRef N
set Exif.GPSInfo.GPSLatitude 51/1 106969/10000 0/1
set Exif.GPSInfo.GPSLongitudeRef W
set Exif.GPSInfo.GPSLongitude 1/1 495984/10000 0/1
output_grep_GPSL = """set Exif.GPSInfo.GPSLatitudeRef Ascii N
set Exif.GPSInfo.GPSLatitude Rational 51/1 106969/10000 0/1
set Exif.GPSInfo.GPSLongitudeRef Ascii W
set Exif.GPSInfo.GPSLongitude Rational 1/1 495984/10000 0/1
"""
stdin = [