geopic-tag-reader 1.1.2__py3-none-any.whl → 1.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geopic_tag_reader/__init__.py +1 -1
- geopic_tag_reader/i18n.py +7 -4
- geopic_tag_reader/main.py +18 -13
- geopic_tag_reader/reader.py +24 -15
- geopic_tag_reader/translations/geopic_tag_reader.pot +66 -30
- geopic_tag_reader/writer.py +6 -5
- {geopic_tag_reader-1.1.2.dist-info → geopic_tag_reader-1.1.3.dist-info}/METADATA +1 -1
- geopic_tag_reader-1.1.3.dist-info/RECORD +15 -0
- geopic_tag_reader-1.1.2.dist-info/RECORD +0 -15
- {geopic_tag_reader-1.1.2.dist-info → geopic_tag_reader-1.1.3.dist-info}/LICENSE +0 -0
- {geopic_tag_reader-1.1.2.dist-info → geopic_tag_reader-1.1.3.dist-info}/WHEEL +0 -0
- {geopic_tag_reader-1.1.2.dist-info → geopic_tag_reader-1.1.3.dist-info}/entry_points.txt +0 -0
geopic_tag_reader/__init__.py
CHANGED
geopic_tag_reader/i18n.py
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import gettext
|
|
2
2
|
import os
|
|
3
|
+
from typing import Callable
|
|
3
4
|
|
|
4
|
-
lang_code = globals().get("LANG") or os.getenv("LANG") or "en"
|
|
5
5
|
localedir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "translations")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def init(lang_code: str = "en") -> Callable[[str], str]:
|
|
9
|
+
lang = gettext.translation("geopic_tag_reader", localedir, languages=[lang_code], fallback=True)
|
|
10
|
+
lang.install()
|
|
11
|
+
return lang.gettext
|
geopic_tag_reader/main.py
CHANGED
|
@@ -4,6 +4,7 @@ from geopic_tag_reader import reader
|
|
|
4
4
|
from geopic_tag_reader.model import PictureType
|
|
5
5
|
from typing import Optional
|
|
6
6
|
import pyexiv2 # type: ignore
|
|
7
|
+
from geopic_tag_reader.i18n import init as i18n_init
|
|
7
8
|
|
|
8
9
|
app = typer.Typer(help="GeoPicTagReader")
|
|
9
10
|
|
|
@@ -12,28 +13,30 @@ app = typer.Typer(help="GeoPicTagReader")
|
|
|
12
13
|
def read(
|
|
13
14
|
image: Path = typer.Option(..., help="Path to your JPEG image file"),
|
|
14
15
|
ignore_exiv2_errors: bool = typer.Option(False, "--ignore-exiv2-errors", help="Do not stop execution even if Exiv2 throws errors"),
|
|
16
|
+
lang: str = typer.Option("en", help="Lang code (2 letters) to use for printing messages"),
|
|
15
17
|
):
|
|
16
18
|
"""Reads EXIF metadata from a picture file, and prints results"""
|
|
17
19
|
|
|
18
20
|
with open(image, "rb") as img:
|
|
19
21
|
pyexiv2.set_log_level(4 if ignore_exiv2_errors else 2)
|
|
20
22
|
|
|
21
|
-
metadata = reader.readPictureMetadata(img.read())
|
|
23
|
+
metadata = reader.readPictureMetadata(img.read(), lang)
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
print("
|
|
25
|
-
print("
|
|
26
|
-
print("
|
|
27
|
-
print("
|
|
28
|
-
print("
|
|
29
|
-
print("
|
|
30
|
-
print("
|
|
31
|
-
print("
|
|
32
|
-
print("
|
|
33
|
-
print("
|
|
25
|
+
_ = i18n_init(lang)
|
|
26
|
+
print(_("Latitude:"), metadata.lat)
|
|
27
|
+
print(_("Longitude:"), metadata.lon)
|
|
28
|
+
print(_("Timestamp:"), metadata.ts.isoformat())
|
|
29
|
+
print(_("Heading:"), metadata.heading)
|
|
30
|
+
print(_("Type:"), metadata.type)
|
|
31
|
+
print(_("Make:"), metadata.make)
|
|
32
|
+
print(_("Model:"), metadata.model)
|
|
33
|
+
print(_("Focal length:"), metadata.focal_length)
|
|
34
|
+
print(_("Crop parameters:"), metadata.crop)
|
|
35
|
+
print(_("Pitch:"), metadata.pitch)
|
|
36
|
+
print(_("Roll:"), metadata.roll)
|
|
34
37
|
|
|
35
38
|
if len(metadata.tagreader_warnings) > 0:
|
|
36
|
-
print("Warnings raised by reader:")
|
|
39
|
+
print(_("Warnings raised by reader:"))
|
|
37
40
|
for w in metadata.tagreader_warnings:
|
|
38
41
|
print(" - " + w)
|
|
39
42
|
|
|
@@ -60,6 +63,7 @@ def write(
|
|
|
60
63
|
default=None,
|
|
61
64
|
help="type of picture, `equirectangular` for 360° pictures, `flat` otherwise",
|
|
62
65
|
),
|
|
66
|
+
lang: str = typer.Option("en", help="Lang code (2 letters) to use for printing messages"),
|
|
63
67
|
):
|
|
64
68
|
"""Override certain exiftags of a picture and write a new picture in another file"""
|
|
65
69
|
from geopic_tag_reader import writer
|
|
@@ -71,6 +75,7 @@ def write(
|
|
|
71
75
|
updated_pic = writer.writePictureMetadata(
|
|
72
76
|
raw_input.read(),
|
|
73
77
|
writer.PictureMetadata(capture_time=capture_dt, longitude=longitude, latitude=latitude, picture_type=picture_type),
|
|
78
|
+
lang,
|
|
74
79
|
)
|
|
75
80
|
|
|
76
81
|
out = output or input
|
geopic_tag_reader/reader.py
CHANGED
|
@@ -2,14 +2,14 @@ import xmltodict
|
|
|
2
2
|
import pyexiv2 # type: ignore
|
|
3
3
|
import datetime
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
|
-
from typing import Dict, List, Optional, Any, Set, Tuple
|
|
5
|
+
from typing import Dict, List, Optional, Any, Set, Tuple, Callable
|
|
6
6
|
import re
|
|
7
7
|
import json
|
|
8
8
|
from fractions import Fraction
|
|
9
9
|
from geopic_tag_reader import camera
|
|
10
10
|
import timezonefinder # type: ignore
|
|
11
11
|
import pytz
|
|
12
|
-
from geopic_tag_reader.i18n import
|
|
12
|
+
from geopic_tag_reader.i18n import init as i18n_init
|
|
13
13
|
|
|
14
14
|
# This is a fix for invalid MakerNotes leading to picture not read at all
|
|
15
15
|
# https://github.com/LeoHsiao1/pyexiv2/issues/58
|
|
@@ -86,6 +86,10 @@ class InvalidExifException(Exception):
|
|
|
86
86
|
super().__init__(msg)
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
class InvalidFractionException(Exception):
|
|
90
|
+
"""Exception for invalid list of fractions"""
|
|
91
|
+
|
|
92
|
+
|
|
89
93
|
@dataclass
|
|
90
94
|
class PartialGeoPicTags:
|
|
91
95
|
"""Tags associated to a geolocated picture when not all tags have been found
|
|
@@ -122,16 +126,18 @@ class PartialExifException(Exception):
|
|
|
122
126
|
self.tags = partial_tags
|
|
123
127
|
|
|
124
128
|
|
|
125
|
-
def readPictureMetadata(picture: bytes) -> GeoPicTags:
|
|
129
|
+
def readPictureMetadata(picture: bytes, lang_code: str = "en") -> GeoPicTags:
|
|
126
130
|
"""Extracts metadata from picture file
|
|
127
131
|
|
|
128
132
|
Args:
|
|
129
133
|
picture (bytes): Picture file
|
|
134
|
+
lang_code (str): Language code for translating error labels
|
|
130
135
|
|
|
131
136
|
Returns:
|
|
132
137
|
GeoPicTags: Extracted metadata from picture
|
|
133
138
|
"""
|
|
134
139
|
|
|
140
|
+
_ = i18n_init(lang_code)
|
|
135
141
|
warnings = []
|
|
136
142
|
img = pyexiv2.ImageData(picture)
|
|
137
143
|
data = {}
|
|
@@ -159,12 +165,12 @@ def readPictureMetadata(picture: bytes) -> GeoPicTags:
|
|
|
159
165
|
data[k] = re.sub(r"charset=[^\s]+", "", v).strip()
|
|
160
166
|
|
|
161
167
|
# Parse latitude/longitude
|
|
162
|
-
lat, lon, llw = decodeLatLon(data, "Exif.GPSInfo")
|
|
168
|
+
lat, lon, llw = decodeLatLon(data, "Exif.GPSInfo", _)
|
|
163
169
|
if len(llw) > 0:
|
|
164
170
|
warnings.extend(llw)
|
|
165
171
|
|
|
166
172
|
if lat is None:
|
|
167
|
-
lat, lon, llw = decodeLatLon(data, "Xmp.exif")
|
|
173
|
+
lat, lon, llw = decodeLatLon(data, "Xmp.exif", _)
|
|
168
174
|
if len(llw) > 0:
|
|
169
175
|
warnings.extend(llw)
|
|
170
176
|
|
|
@@ -179,13 +185,13 @@ def readPictureMetadata(picture: bytes) -> GeoPicTags:
|
|
|
179
185
|
raise InvalidExifException(_("Read longitude is out of WGS84 bounds (should be in [-180, 180])"))
|
|
180
186
|
|
|
181
187
|
# Parse date/time
|
|
182
|
-
d, llw = decodeGPSDateTime(data, "Exif.GPSInfo", lat, lon)
|
|
188
|
+
d, llw = decodeGPSDateTime(data, "Exif.GPSInfo", _, lat, lon)
|
|
183
189
|
|
|
184
190
|
if len(llw) > 0:
|
|
185
191
|
warnings.extend(llw)
|
|
186
192
|
|
|
187
193
|
if d is None:
|
|
188
|
-
d, llw = decodeGPSDateTime(data, "Xmp.exif", lat, lon)
|
|
194
|
+
d, llw = decodeGPSDateTime(data, "Xmp.exif", _, lat, lon)
|
|
189
195
|
if len(llw) > 0:
|
|
190
196
|
warnings.extend(llw)
|
|
191
197
|
|
|
@@ -196,7 +202,7 @@ def readPictureMetadata(picture: bytes) -> GeoPicTags:
|
|
|
196
202
|
"Xmp.GPano.SourceImageCreateTime",
|
|
197
203
|
]:
|
|
198
204
|
if d is None:
|
|
199
|
-
d, llw = decodeDateTimeOriginal(data, exifField, lat, lon)
|
|
205
|
+
d, llw = decodeDateTimeOriginal(data, exifField, _, lat, lon)
|
|
200
206
|
if len(llw) > 0:
|
|
201
207
|
warnings.extend(llw)
|
|
202
208
|
|
|
@@ -423,14 +429,14 @@ def decodeManyFractions(value: str) -> List[Fraction]:
|
|
|
423
429
|
try:
|
|
424
430
|
vals = [Fraction(v.strip()) for v in value.split(" ")]
|
|
425
431
|
if len([True for v in vals if v.denominator == 0]) > 0:
|
|
426
|
-
raise
|
|
432
|
+
raise InvalidFractionException()
|
|
427
433
|
return vals
|
|
428
434
|
|
|
429
435
|
except:
|
|
430
|
-
raise
|
|
436
|
+
raise InvalidFractionException()
|
|
431
437
|
|
|
432
438
|
|
|
433
|
-
def decodeLatLon(data: dict, group: str) -> Tuple[Optional[float], Optional[float], List[str]]:
|
|
439
|
+
def decodeLatLon(data: dict, group: str, _: Callable[[str], str]) -> Tuple[Optional[float], Optional[float], List[str]]:
|
|
434
440
|
"""Reads GPS info from given group to get latitude/longitude as float coordinates"""
|
|
435
441
|
|
|
436
442
|
lat, lon = None, None
|
|
@@ -486,7 +492,7 @@ def decodeLatLon(data: dict, group: str) -> Tuple[Optional[float], Optional[floa
|
|
|
486
492
|
|
|
487
493
|
|
|
488
494
|
def decodeDateTimeOriginal(
|
|
489
|
-
data: dict, datetimeField: str, lat: Optional[float] = None, lon: Optional[float] = None
|
|
495
|
+
data: dict, datetimeField: str, _: Callable[[str], str], lat: Optional[float] = None, lon: Optional[float] = None
|
|
490
496
|
) -> Tuple[Optional[datetime.datetime], List[str]]:
|
|
491
497
|
d = None
|
|
492
498
|
warnings = []
|
|
@@ -498,7 +504,9 @@ def decodeDateTimeOriginal(
|
|
|
498
504
|
hourRaw = int(timeRaw[0])
|
|
499
505
|
minutesRaw = int(timeRaw[1])
|
|
500
506
|
secondsRaw, microsecondsRaw, msw = decodeSecondsAndMicroSeconds(
|
|
501
|
-
timeRaw[2],
|
|
507
|
+
timeRaw[2],
|
|
508
|
+
data["Exif.Photo.SubSecTimeOriginal"] if isExifTagUsable(data, "Exif.Photo.SubSecTimeOriginal", float) else "0",
|
|
509
|
+
_,
|
|
502
510
|
)
|
|
503
511
|
warnings += msw
|
|
504
512
|
|
|
@@ -550,7 +558,7 @@ def decodeTimeOffset(data: dict, offsetTimeField: str) -> Optional[datetime.tzin
|
|
|
550
558
|
|
|
551
559
|
|
|
552
560
|
def decodeGPSDateTime(
|
|
553
|
-
data: dict, group: str, lat: Optional[float] = None, lon: Optional[float] = None
|
|
561
|
+
data: dict, group: str, _: Callable[[str], str], lat: Optional[float] = None, lon: Optional[float] = None
|
|
554
562
|
) -> Tuple[Optional[datetime.datetime], List[str]]:
|
|
555
563
|
d = None
|
|
556
564
|
warnings = []
|
|
@@ -576,6 +584,7 @@ def decodeGPSDateTime(
|
|
|
576
584
|
seconds, microseconds, msw = decodeSecondsAndMicroSeconds(
|
|
577
585
|
str(float(timeRaw[2])),
|
|
578
586
|
data["Exif.Photo.SubSecTimeOriginal"] if isExifTagUsable(data, "Exif.Photo.SubSecTimeOriginal", float) else "0",
|
|
587
|
+
_,
|
|
579
588
|
)
|
|
580
589
|
|
|
581
590
|
warnings += msw
|
|
@@ -607,7 +616,7 @@ def decodeGPSDateTime(
|
|
|
607
616
|
return (d, warnings)
|
|
608
617
|
|
|
609
618
|
|
|
610
|
-
def decodeSecondsAndMicroSeconds(secondsRaw: str, microsecondsRaw: str) -> Tuple[int, int, List[str]]:
|
|
619
|
+
def decodeSecondsAndMicroSeconds(secondsRaw: str, microsecondsRaw: str, _: Callable[[str], str]) -> Tuple[int, int, List[str]]:
|
|
611
620
|
warnings = []
|
|
612
621
|
|
|
613
622
|
# Read microseconds from SubSecTime field
|
|
@@ -8,7 +8,7 @@ msgid ""
|
|
|
8
8
|
msgstr ""
|
|
9
9
|
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
|
11
|
-
"POT-Creation-Date: 2024-
|
|
11
|
+
"POT-Creation-Date: 2024-07-10 08:17+0200\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -17,95 +17,131 @@ msgstr ""
|
|
|
17
17
|
"Content-Type: text/plain; charset=CHARSET\n"
|
|
18
18
|
"Content-Transfer-Encoding: 8bit\n"
|
|
19
19
|
|
|
20
|
-
#: geopic_tag_reader/
|
|
20
|
+
#: geopic_tag_reader/main.py:26
|
|
21
|
+
msgid "Latitude:"
|
|
22
|
+
msgstr ""
|
|
23
|
+
|
|
24
|
+
#: geopic_tag_reader/main.py:27
|
|
25
|
+
msgid "Longitude:"
|
|
26
|
+
msgstr ""
|
|
27
|
+
|
|
28
|
+
#: geopic_tag_reader/main.py:28
|
|
29
|
+
msgid "Timestamp:"
|
|
30
|
+
msgstr ""
|
|
31
|
+
|
|
32
|
+
#: geopic_tag_reader/main.py:29
|
|
33
|
+
msgid "Heading:"
|
|
34
|
+
msgstr ""
|
|
35
|
+
|
|
36
|
+
#: geopic_tag_reader/main.py:30
|
|
37
|
+
msgid "Type:"
|
|
38
|
+
msgstr ""
|
|
39
|
+
|
|
40
|
+
#: geopic_tag_reader/main.py:31
|
|
41
|
+
msgid "Make:"
|
|
42
|
+
msgstr ""
|
|
43
|
+
|
|
44
|
+
#: geopic_tag_reader/main.py:32
|
|
45
|
+
msgid "Model:"
|
|
46
|
+
msgstr ""
|
|
47
|
+
|
|
48
|
+
#: geopic_tag_reader/main.py:33
|
|
49
|
+
msgid "Focal length:"
|
|
50
|
+
msgstr ""
|
|
51
|
+
|
|
52
|
+
#: geopic_tag_reader/main.py:34
|
|
53
|
+
msgid "Crop parameters:"
|
|
54
|
+
msgstr ""
|
|
55
|
+
|
|
56
|
+
#: geopic_tag_reader/main.py:35
|
|
57
|
+
msgid "Pitch:"
|
|
58
|
+
msgstr ""
|
|
59
|
+
|
|
60
|
+
#: geopic_tag_reader/main.py:36
|
|
61
|
+
msgid "Roll:"
|
|
62
|
+
msgstr ""
|
|
63
|
+
|
|
64
|
+
#: geopic_tag_reader/main.py:39
|
|
65
|
+
msgid "Warnings raised by reader:"
|
|
66
|
+
msgstr ""
|
|
67
|
+
|
|
68
|
+
#: geopic_tag_reader/reader.py:183
|
|
21
69
|
msgid "Read latitude is out of WGS84 bounds (should be in [-90, 90])"
|
|
22
70
|
msgstr ""
|
|
23
71
|
|
|
24
|
-
#: geopic_tag_reader/reader.py:
|
|
72
|
+
#: geopic_tag_reader/reader.py:185
|
|
25
73
|
msgid "Read longitude is out of WGS84 bounds (should be in [-180, 180])"
|
|
26
74
|
msgstr ""
|
|
27
75
|
|
|
28
|
-
#: geopic_tag_reader/reader.py:
|
|
76
|
+
#: geopic_tag_reader/reader.py:227
|
|
29
77
|
#, python-brace-format
|
|
30
78
|
msgid "Skipping Mapillary date/time as it was not recognized: {v}"
|
|
31
79
|
msgstr ""
|
|
32
80
|
|
|
33
|
-
#: geopic_tag_reader/reader.py:
|
|
81
|
+
#: geopic_tag_reader/reader.py:240
|
|
34
82
|
msgid "Contradicting heading values found, GPSImgDirection value is used"
|
|
35
83
|
msgstr ""
|
|
36
84
|
|
|
37
|
-
#: geopic_tag_reader/reader.py:
|
|
85
|
+
#: geopic_tag_reader/reader.py:351
|
|
38
86
|
msgid "No GPS coordinates or broken coordinates in picture EXIF tags"
|
|
39
87
|
msgstr ""
|
|
40
88
|
|
|
41
|
-
#: geopic_tag_reader/reader.py:
|
|
89
|
+
#: geopic_tag_reader/reader.py:357
|
|
42
90
|
msgid "No valid date in picture EXIF tags"
|
|
43
91
|
msgstr ""
|
|
44
92
|
|
|
45
|
-
#: geopic_tag_reader/reader.py:
|
|
93
|
+
#: geopic_tag_reader/reader.py:362
|
|
46
94
|
msgid "The picture is missing mandatory metadata:"
|
|
47
95
|
msgstr ""
|
|
48
96
|
|
|
49
|
-
#: geopic_tag_reader/reader.py:
|
|
50
|
-
msgid "Not a valid list of fractions"
|
|
51
|
-
msgstr ""
|
|
52
|
-
|
|
53
|
-
#: geopic_tag_reader/reader.py:443 geopic_tag_reader/reader.py:472
|
|
97
|
+
#: geopic_tag_reader/reader.py:449 geopic_tag_reader/reader.py:478
|
|
54
98
|
msgid "GPSLatitudeRef not found, assuming GPSLatitudeRef is North"
|
|
55
99
|
msgstr ""
|
|
56
100
|
|
|
57
|
-
#: geopic_tag_reader/reader.py:
|
|
101
|
+
#: geopic_tag_reader/reader.py:457
|
|
58
102
|
msgid "Broken GPS coordinates in picture EXIF tags"
|
|
59
103
|
msgstr ""
|
|
60
104
|
|
|
61
|
-
#: geopic_tag_reader/reader.py:
|
|
105
|
+
#: geopic_tag_reader/reader.py:460 geopic_tag_reader/reader.py:484
|
|
62
106
|
msgid "GPSLongitudeRef not found, assuming GPSLongitudeRef is East"
|
|
63
107
|
msgstr ""
|
|
64
108
|
|
|
65
|
-
#: geopic_tag_reader/reader.py:
|
|
109
|
+
#: geopic_tag_reader/reader.py:537
|
|
66
110
|
msgid "Precise timezone information not found, fallback to UTC"
|
|
67
111
|
msgstr ""
|
|
68
112
|
|
|
69
|
-
#: geopic_tag_reader/reader.py:
|
|
113
|
+
#: geopic_tag_reader/reader.py:542
|
|
70
114
|
msgid ""
|
|
71
115
|
"Precise timezone information not found (and no GPS coordinates to help), "
|
|
72
116
|
"fallback to UTC"
|
|
73
117
|
msgstr ""
|
|
74
118
|
|
|
75
|
-
#: geopic_tag_reader/reader.py:
|
|
119
|
+
#: geopic_tag_reader/reader.py:546
|
|
76
120
|
#, python-brace-format
|
|
77
121
|
msgid ""
|
|
78
122
|
"Skipping original date/time (from {datefield}) as it was not recognized: {v}"
|
|
79
123
|
msgstr ""
|
|
80
124
|
|
|
81
|
-
#: geopic_tag_reader/reader.py:
|
|
125
|
+
#: geopic_tag_reader/reader.py:580
|
|
82
126
|
#, python-brace-format
|
|
83
127
|
msgid ""
|
|
84
128
|
"GPSTimeStamp and GPSDateTime don't contain supported time format (in {group} "
|
|
85
129
|
"group)"
|
|
86
130
|
msgstr ""
|
|
87
131
|
|
|
88
|
-
#: geopic_tag_reader/reader.py:
|
|
132
|
+
#: geopic_tag_reader/reader.py:611
|
|
89
133
|
#, python-brace-format
|
|
90
134
|
msgid "Skipping GPS date/time ({group} group) as it was not recognized: {v}"
|
|
91
135
|
msgstr ""
|
|
92
136
|
|
|
93
|
-
#: geopic_tag_reader/reader.py:
|
|
137
|
+
#: geopic_tag_reader/reader.py:637
|
|
94
138
|
#, python-brace-format
|
|
95
139
|
msgid ""
|
|
96
140
|
"Microseconds read from decimal seconds value ({microsecondsFromSeconds}) is "
|
|
97
141
|
"not matching value from EXIF field ({microseconds}). Max value will be kept."
|
|
98
142
|
msgstr ""
|
|
99
143
|
|
|
100
|
-
#: geopic_tag_reader/writer.py:
|
|
101
|
-
msgid ""
|
|
102
|
-
"Impossible to write the exif tags without the '[write-exif]' dependency "
|
|
103
|
-
"(that will need to install libexiv2).\n"
|
|
104
|
-
"Install this package with `pip install geopic-tag-reader[write-exif]` to use "
|
|
105
|
-
"this function"
|
|
106
|
-
msgstr ""
|
|
107
|
-
|
|
108
|
-
#: geopic_tag_reader/writer.py:131
|
|
144
|
+
#: geopic_tag_reader/writer.py:132
|
|
109
145
|
#, python-brace-format
|
|
110
146
|
msgid "Unsupported key in additional tags ({k})"
|
|
111
147
|
msgstr ""
|
geopic_tag_reader/writer.py
CHANGED
|
@@ -5,16 +5,14 @@ from geopic_tag_reader.model import PictureType
|
|
|
5
5
|
from enum import Enum
|
|
6
6
|
import timezonefinder # type: ignore
|
|
7
7
|
import pytz
|
|
8
|
-
from geopic_tag_reader.i18n import
|
|
8
|
+
from geopic_tag_reader.i18n import init as i18n_init
|
|
9
9
|
|
|
10
10
|
try:
|
|
11
11
|
import pyexiv2 # type: ignore
|
|
12
12
|
except ImportError:
|
|
13
13
|
raise Exception(
|
|
14
|
-
|
|
15
|
-
"""Impossible to write the exif tags without the '[write-exif]' dependency (that will need to install libexiv2).
|
|
14
|
+
"""Impossible to write the exif tags without the '[write-exif]' dependency (that will need to install libexiv2).
|
|
16
15
|
Install this package with `pip install geopic-tag-reader[write-exif]` to use this function"""
|
|
17
|
-
)
|
|
18
16
|
)
|
|
19
17
|
|
|
20
18
|
tz_finder = timezonefinder.TimezoneFinder()
|
|
@@ -75,10 +73,13 @@ def _fraction(value: float):
|
|
|
75
73
|
return f"{int(value * FLOAT_PRECISION)}/{FLOAT_PRECISION}"
|
|
76
74
|
|
|
77
75
|
|
|
78
|
-
def writePictureMetadata(picture: bytes, metadata: PictureMetadata) -> bytes:
|
|
76
|
+
def writePictureMetadata(picture: bytes, metadata: PictureMetadata, lang_code: str = "en") -> bytes:
|
|
79
77
|
"""
|
|
80
78
|
Override exif metadata on raw picture and return updated bytes
|
|
81
79
|
"""
|
|
80
|
+
|
|
81
|
+
_ = i18n_init(lang_code)
|
|
82
|
+
|
|
82
83
|
if not metadata.has_change():
|
|
83
84
|
return picture
|
|
84
85
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
geopic_tag_reader/__init__.py,sha256=5U9FfeZGkInbD3H9zaqteUjP5wK3mmNATj3vZPy31pE,47
|
|
2
|
+
geopic_tag_reader/camera.py,sha256=Nw6dQjnrUCCOXujjk8Y7IwjJPMuDf4DAGCmHk0LDfEg,1975
|
|
3
|
+
geopic_tag_reader/i18n.py,sha256=LOLBj7eB_hpHTc5XdMP97EoWdD2kgmkP_uvJJDKEVsU,342
|
|
4
|
+
geopic_tag_reader/main.py,sha256=NJFDdPlyj0HvBcPABTVPqdSPm0SP3lnW4HF1fmhONY4,3550
|
|
5
|
+
geopic_tag_reader/model.py,sha256=rsWVE3T1kpNsKXX8iv6xb_3PCVY6Ea7iU9WOqUgXklU,129
|
|
6
|
+
geopic_tag_reader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
geopic_tag_reader/reader.py,sha256=4tk-qvN-mBryp8FbtG9smQkSlWDjWZU1CDedm07MqP0,25746
|
|
8
|
+
geopic_tag_reader/writer.py,sha256=HdZenoY_5Qv1Kq0jedCJhVFDYsv0iQaCzB6necU_LrY,8793
|
|
9
|
+
geopic_tag_reader/translations/geopic_tag_reader.pot,sha256=1myoxYDZfHh7R_Iiyn9VFdz5T6nbYR3S_jxFhkrw0GI,3590
|
|
10
|
+
geopic_tag_reader/translations/fr/LC_MESSAGES/geopic_tag_reader.po,sha256=QxuV0AYxOAVCI4xaKDDCvgUfeym6oRQC2YeRJpI9i9c,4223
|
|
11
|
+
geopic_tag_reader-1.1.3.dist-info/entry_points.txt,sha256=c9YwjCNhxveDf-61_aSRlzcpoutvM6KQCerlzaVt_JU,64
|
|
12
|
+
geopic_tag_reader-1.1.3.dist-info/LICENSE,sha256=oHWDwXkJJb9zJzThMN3F9Li4yFhz1qxOUByouY7L3bI,1070
|
|
13
|
+
geopic_tag_reader-1.1.3.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
14
|
+
geopic_tag_reader-1.1.3.dist-info/METADATA,sha256=UWeERQ-wFwg-URJUXsRaGJLzcuJq8BkQNmw-3jSpcJ0,4578
|
|
15
|
+
geopic_tag_reader-1.1.3.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
geopic_tag_reader/__init__.py,sha256=DCAt2kbPER8vsAuxzbjuzgbgYxV4aajpxsaPx--ZQ28,47
|
|
2
|
-
geopic_tag_reader/camera.py,sha256=Nw6dQjnrUCCOXujjk8Y7IwjJPMuDf4DAGCmHk0LDfEg,1975
|
|
3
|
-
geopic_tag_reader/i18n.py,sha256=MnhttLwppXnioXYUdlTi1J9SPtSKhaHc9ARYtsS5t-M,303
|
|
4
|
-
geopic_tag_reader/main.py,sha256=ZEZaZEeaDxRjrVMwhR5lUYJWKkUcjd8avjqm7JxJdhM,3219
|
|
5
|
-
geopic_tag_reader/model.py,sha256=rsWVE3T1kpNsKXX8iv6xb_3PCVY6Ea7iU9WOqUgXklU,129
|
|
6
|
-
geopic_tag_reader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
geopic_tag_reader/reader.py,sha256=lHAMafZK7rCFsO1joCXGrbjyYJfgwab7dQF-eKFLRHs,25337
|
|
8
|
-
geopic_tag_reader/writer.py,sha256=gUvs2fVe7VIMzsT6ZGnXOiKqtsTgndDaJeTTCYnOpXQ,8748
|
|
9
|
-
geopic_tag_reader/translations/geopic_tag_reader.pot,sha256=-Z6YYskO_jYKXGJssbfigAixHMcAXylNAMKebcjFCXY,3198
|
|
10
|
-
geopic_tag_reader/translations/fr/LC_MESSAGES/geopic_tag_reader.po,sha256=QxuV0AYxOAVCI4xaKDDCvgUfeym6oRQC2YeRJpI9i9c,4223
|
|
11
|
-
geopic_tag_reader-1.1.2.dist-info/entry_points.txt,sha256=c9YwjCNhxveDf-61_aSRlzcpoutvM6KQCerlzaVt_JU,64
|
|
12
|
-
geopic_tag_reader-1.1.2.dist-info/LICENSE,sha256=oHWDwXkJJb9zJzThMN3F9Li4yFhz1qxOUByouY7L3bI,1070
|
|
13
|
-
geopic_tag_reader-1.1.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
14
|
-
geopic_tag_reader-1.1.2.dist-info/METADATA,sha256=fH9KBmz593jrgLNiRrYrWYH2gSWBi_xPXghP22v_92k,4578
|
|
15
|
-
geopic_tag_reader-1.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|