fix_1180_date_separator

v0.27.3
clanmills 5 years ago
parent 7fa2ce90dc
commit 92f2458229

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH EXIV2 1 "March 28, 2020" .TH EXIV2 1 "April 25, 2020"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -271,12 +271,14 @@ options.
Set the file timestamp according to the Exif create timestamp in Set the file timestamp according to the Exif create timestamp in
addition to renaming the file (overrides \fB\-k\fP). This option is addition to renaming the file (overrides \fB\-k\fP). This option is
only used with the 'rename' action. only used with the 'rename' action.
See Exif DateTime below for additional information.
.TP .TP
.B \-T .B \-T
Only set the file timestamp according to the Exif create timestamp, do Only set the file timestamp according to the Exif create timestamp, do
not rename the file (overrides \fB\-k\fP). This option is only used not rename the file (overrides \fB\-k\fP). This option is only used
with the 'rename' action. Note: On Windows you may have to set the TZ with the 'rename' action. Note: On Windows you may have to set the TZ
environment variable for this option to work correctly. environment variable for this option to work correctly.
See Exif DateTime below for additional information.
.TP .TP
.B \-f,\-F .B \-f,\-F
These options are used by the commands 'rename' and 'extract' to These options are used by the commands 'rename' and 'extract' to
@ -327,6 +329,7 @@ Default filename format is %Y%m%d_%H%M%S.
Time adjustment in the format [\-]HH[:MM[:SS]]. This option is only Time adjustment in the format [\-]HH[:MM[:SS]]. This option is only
used with the 'adjust' action. Examples: 1 adds one hour, 1:01 used with the 'adjust' action. Examples: 1 adds one hour, 1:01
adds one hour and one minute, \-0:00:30 subtracts 30 seconds. adds one hour and one minute, \-0:00:30 subtracts 30 seconds.
See Exif DateTime below for additional information.
.TP .TP
.B \-Y \fIyrs\fP .B \-Y \fIyrs\fP
Time adjustment by a positive or negative number of years, for Time adjustment by a positive or negative number of years, for
@ -622,6 +625,16 @@ To register additional XMP namespaces, combine the command with:
.nf .nf
\fBreg\fP \fIprefix\fP \fInamespace\fP \fBreg\fP \fIprefix\fP \fInamespace\fP
.br .br
.SS Exif DateTime
.fi
An Exif DateTime string is stored as 20 ascii bytes (including trailing nul) in the format:
.sp 1
YYYY:MM:DD HH:MM:SS
.sp 1
The exiv2 command-line program options -t and -T will accept files
in which the Date has been incorrectly stored as YYYY-MM-DD.
The option -a enables the user to adjust the DateTime in the file and applies
the YYYY:MM:DD HH:MM:SS standard.
.ne 4 .ne 4
.fi .fi
.SS Command file format .SS Command file format

@ -1971,7 +1971,7 @@ namespace {
{ {
if (timeStr.length() == 0 || timeStr[0] == ' ') return 1; if (timeStr.length() == 0 || timeStr[0] == ' ') return 1;
if (timeStr.length() < 19) return 2; if (timeStr.length() < 19) return 2;
if ( timeStr[4] != ':' || timeStr[7] != ':' || timeStr[10] != ' ' if ( (timeStr[4] != ':' && timeStr[4] != '-') || (timeStr[7] != ':' && timeStr[7] != '-') || timeStr[10] != ' '
|| timeStr[13] != ':' || timeStr[16] != ':') return 3; || timeStr[13] != ':' || timeStr[16] != ':') return 3;
if (0 == tm) return 4; if (0 == tm) return 4;
std::memset(tm, 0x0, sizeof(struct tm)); std::memset(tm, 0x0, sizeof(struct tm));

Binary file not shown.

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from system_tests import CaseMeta, CopyTmpFiles, path
@CopyTmpFiles("$data_path/test_issue_1180.exv")
class test_issue_1180Test(metaclass=CaseMeta):
filename = path("$tmp_path/test_issue_1180.exv")
dash_t = path("$tmp_path/20200424_174415.exv") # -t renames file
dash_T = path("$tmp_path/20200424_154415.exv") # -T renames file
commands = [ "$exiv2 -K Exif.Image.DateTime $filename"
, "$exiv2 -t --force $filename"
, "$exiv2 -K Exif.Image.DateTime $dash_t"
, "$exiv2 -a -02:00 --force $dash_t"
, "$exiv2 -K Exif.Image.DateTime $dash_t"
, "$exiv2 -t --force $dash_t"
, "$exiv2 -K Exif.Image.DateTime $dash_T"
]
stdout = ["Exif.Image.DateTime Ascii 50 2020-04-24 17:44:15 \n"
,""
,"Exif.Image.DateTime Ascii 50 2020-04-24 17:44:15 \n"
,""
,"Exif.Image.DateTime Ascii 20 2020:04:24 15:44:15\n"
,""
,"Exif.Image.DateTime Ascii 20 2020:04:24 15:44:15\n"
]
stderr = [""]*len(commands)
retval = [ 0]*len(commands)

@ -14,6 +14,7 @@ exiv2_path: ../build/bin
exiv2: ${ENV:exiv2_path}/exiv2${ENV:binary_extension} exiv2: ${ENV:exiv2_path}/exiv2${ENV:binary_extension}
exiv2json: ${ENV:exiv2_path}/exiv2json${ENV:binary_extension} exiv2json: ${ENV:exiv2_path}/exiv2json${ENV:binary_extension}
data_path: ../test/data data_path: ../test/data
tmp_path: ../test/tmp
tiff_test: ${ENV:exiv2_path}/tiff-test${ENV:binary_extension} tiff_test: ${ENV:exiv2_path}/tiff-test${ENV:binary_extension}
largeiptc_test: ${ENV:exiv2_path}/largeiptc-test${ENV:binary_extension} largeiptc_test: ${ENV:exiv2_path}/largeiptc-test${ENV:binary_extension}
easyaccess_test: ${ENV:exiv2_path}/easyaccess-test${ENV:binary_extension} easyaccess_test: ${ENV:exiv2_path}/easyaccess-test${ENV:binary_extension}

@ -461,6 +461,26 @@ class CopyFiles(FileDecoratorBase):
new_name = fname + '_copy' + ext new_name = fname + '_copy' + ext
return shutil.copyfile(expanded_file_name, new_name) return shutil.copyfile(expanded_file_name, new_name)
class CopyTmpFiles(FileDecoratorBase):
"""
This class copies files from test/data to test/tmp
Copied files are NOT removed in tearDown
Example: @CopyTmpFiles("$data_path/test_issue_1180.exv")
"""
#: override the name of the file list
FILE_LIST_NAME = '_tmp_files'
def setUp_file_action(self, expanded_file_name):
fname, ext = os.path.splitext(expanded_file_name)
tmp_dir = os.path.join(os.path.dirname(os.path.dirname(expanded_file_name)),'tmp')
tmp_name = os.path.join(tmp_dir,os.path.basename(expanded_file_name))
return shutil.copyfile(expanded_file_name, tmp_name)
def tearDown_file_action(self, f):
"""
Do nothing. We don't clean up TmpFiles
"""
class DeleteFiles(FileDecoratorBase): class DeleteFiles(FileDecoratorBase):
""" """

Loading…
Cancel
Save