Skip to content

Commit

Permalink
Output of -PV was not suitable for inputting to -m-, key was missing. (
Browse files Browse the repository at this point in the history
…#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
  • Loading branch information
facundofc authored Dec 29, 2021
1 parent c28e501 commit b52b6db
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/cmdxmp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions exiv2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Expand Down Expand Up @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion src/exiv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion test/data/cmdxmp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions tests/bugfixes/github/test_issue_1969.py
Original file line number Diff line number Diff line change
@@ -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]
8 changes: 4 additions & 4 deletions tests/bugfixes/redmine/test_issue_1137.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit b52b6db

Please sign in to comment.