Skip to content

Commit d8b0148

Browse files
authored
feat: Add GExiv2 (#209)
1 parent 3faeea4 commit d8b0148

File tree

2 files changed

+338
-0
lines changed

2 files changed

+338
-0
lines changed

src/gi-stubs/repository/GExiv2.pyi

Lines changed: 337 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,337 @@
1+
import typing
2+
3+
import datetime
4+
from fractions import Fraction
5+
6+
from gi.repository import Gio
7+
from gi.repository import GLib
8+
from gi.repository import GObject
9+
10+
T = typing.TypeVar("T")
11+
12+
MAJOR_VERSION: int = 0
13+
MICRO_VERSION: int = 3
14+
MINOR_VERSION: int = 14
15+
_introspection_module = ... # FIXME Constant
16+
_lock = ... # FIXME Constant
17+
_namespace: str = "GExiv2"
18+
_overrides_module = ... # FIXME Constant
19+
_version: str = "0.10"
20+
21+
def get_version() -> int: ...
22+
def initialize() -> bool: ...
23+
def log_get_level() -> LogLevel: ...
24+
def log_set_level(level: LogLevel) -> None: ...
25+
def log_use_glib_logging() -> None: ...
26+
27+
class Metadata(GObject.Object):
28+
"""
29+
:Constructors:
30+
31+
::
32+
33+
Metadata(**properties)
34+
new() -> GExiv2.Metadata
35+
36+
Object GExiv2Metadata
37+
38+
Signals from GObject:
39+
notify (GParam)
40+
"""
41+
42+
parent_instance: GObject.Object = ...
43+
priv: MetadataPrivate = ...
44+
# override
45+
def __init__(self, path: typing.Optional[str] = None): ...
46+
def clear(self) -> None: ...
47+
def clear_comment(self) -> None: ...
48+
def clear_exif(self) -> None: ...
49+
def clear_iptc(self) -> None: ...
50+
def clear_tag(self, tag: str) -> bool: ...
51+
def clear_xmp(self) -> None: ...
52+
def delete_gps_info(self) -> None: ...
53+
def erase_exif_thumbnail(self) -> None: ...
54+
def free(self) -> None: ...
55+
def from_app1_segment(self, data: typing.Sequence[int]) -> bool: ...
56+
def from_stream(self, stream: Gio.InputStream) -> bool: ...
57+
def generate_xmp_packet(
58+
self, xmp_format_flags: XmpFormatFlags, padding: int
59+
) -> typing.Optional[str]: ...
60+
# override
61+
def get(self, key, default=None) -> typing.Optional[str]: ...
62+
def get_comment(self) -> typing.Optional[str]: ...
63+
# override
64+
def get_date_time(self) -> datetime.datetime: ...
65+
def get_exif_data(self, byte_order: ByteOrder) -> typing.Optional[GLib.Bytes]: ...
66+
# override
67+
def get_exif_tag_rational(self, key) -> typing.Optional[Fraction]: ...
68+
def get_exif_tags(self) -> list[str]: ...
69+
def get_exif_thumbnail(self) -> typing.Tuple[bool, bytes]: ...
70+
# override
71+
def get_exposure_time(self) -> typing.Optional[Fraction]: ...
72+
def get_fnumber(self) -> float: ...
73+
def get_focal_length(self) -> float: ...
74+
def get_gps_altitude(self) -> typing.Tuple[bool, float]: ...
75+
def get_gps_info(self) -> typing.Tuple[bool, float, float, float]: ...
76+
def get_gps_latitude(self) -> typing.Tuple[bool, float]: ...
77+
def get_gps_longitude(self) -> typing.Tuple[bool, float]: ...
78+
def get_iptc_tags(self) -> list[str]: ...
79+
def get_iso_speed(self) -> int: ...
80+
def get_metadata_pixel_height(self) -> int: ...
81+
def get_metadata_pixel_width(self) -> int: ...
82+
def get_mime_type(self) -> str: ...
83+
def get_orientation(self) -> Orientation: ...
84+
def get_pixel_height(self) -> int: ...
85+
def get_pixel_width(self) -> int: ...
86+
def get_preview_image(self, props: PreviewProperties) -> PreviewImage: ...
87+
def get_preview_properties(self) -> typing.Optional[list[PreviewProperties]]: ...
88+
# override
89+
def get_raw(self, key) -> bytes: ...
90+
def get_supports_exif(self) -> bool: ...
91+
def get_supports_iptc(self) -> bool: ...
92+
def get_supports_xmp(self) -> bool: ...
93+
@staticmethod
94+
def get_tag_description(tag: str) -> typing.Optional[str]: ...
95+
def get_tag_interpreted_string(self, tag: str) -> typing.Optional[str]: ...
96+
@staticmethod
97+
def get_tag_label(tag: str) -> typing.Optional[str]: ...
98+
def get_tag_long(self, tag: str) -> int: ...
99+
def get_tag_multiple(self, tag: str) -> typing.Optional[list[str]]: ...
100+
def get_tag_raw(self, tag: str) -> typing.Optional[GLib.Bytes]: ...
101+
def get_tag_string(self, tag: str) -> typing.Optional[str]: ...
102+
@staticmethod
103+
def get_tag_type(tag: str) -> typing.Optional[str]: ...
104+
# override
105+
def get_tags(self) -> list[str]: ...
106+
@staticmethod
107+
def get_xmp_namespace_for_tag(tag: str) -> str: ...
108+
def get_xmp_packet(self) -> typing.Optional[str]: ...
109+
def get_xmp_tags(self) -> list[str]: ...
110+
def has_exif(self) -> bool: ...
111+
def has_iptc(self) -> bool: ...
112+
def has_tag(self, tag: str) -> bool: ...
113+
def has_xmp(self) -> bool: ...
114+
@staticmethod
115+
def is_exif_tag(tag: str) -> bool: ...
116+
@staticmethod
117+
def is_iptc_tag(tag: str) -> bool: ...
118+
@staticmethod
119+
def is_xmp_tag(tag: str) -> bool: ...
120+
@classmethod
121+
def new(cls) -> Metadata: ...
122+
def open_buf(self, data: typing.Sequence[int]) -> bool: ...
123+
# override
124+
def open_path(self, path: typing.Optional[str]): ...
125+
@staticmethod
126+
def register_xmp_namespace(name: str, prefix: str) -> bool: ...
127+
def save_external(self, path: str) -> bool: ...
128+
# override
129+
def save_file(self, path: typing.Optional[str] = None): ...
130+
def set_comment(self, comment: str) -> None: ...
131+
# override
132+
def set_date_time(self, value: str): ...
133+
# override
134+
def set_exif_tag_rational(self, key, fraction: Fraction): ...
135+
def set_exif_thumbnail_from_buffer(self, buffer: typing.Sequence[int]) -> None: ...
136+
def set_exif_thumbnail_from_file(self, path: str) -> bool: ...
137+
def set_gps_info(
138+
self, longitude: float, latitude: float, altitude: float
139+
) -> bool: ...
140+
def set_metadata_pixel_height(self, height: int) -> None: ...
141+
def set_metadata_pixel_width(self, width: int) -> None: ...
142+
def set_orientation(self, orientation: Orientation) -> None: ...
143+
def set_tag_long(self, tag: str, value: int) -> bool: ...
144+
def set_tag_multiple(self, tag: str, values: typing.Sequence[str]) -> bool: ...
145+
def set_tag_string(self, tag: str, value: str) -> bool: ...
146+
def set_xmp_tag_struct(self, tag: str, type: StructureType) -> bool: ...
147+
def try_clear_tag(self, tag: str) -> bool: ...
148+
def try_delete_gps_info(self) -> None: ...
149+
def try_erase_exif_thumbnail(self) -> None: ...
150+
def try_generate_xmp_packet(
151+
self, xmp_format_flags: XmpFormatFlags, padding: int
152+
) -> typing.Optional[str]: ...
153+
def try_get_comment(self) -> typing.Optional[str]: ...
154+
def try_get_exif_tag_rational(self, tag: str) -> typing.Tuple[bool, int, int]: ...
155+
def try_get_exposure_time(self) -> typing.Tuple[bool, int, int]: ...
156+
def try_get_fnumber(self) -> float: ...
157+
def try_get_focal_length(self) -> float: ...
158+
def try_get_gps_altitude(self) -> typing.Tuple[bool, float]: ...
159+
def try_get_gps_info(self) -> typing.Tuple[bool, float, float, float]: ...
160+
def try_get_gps_latitude(self) -> typing.Tuple[bool, float]: ...
161+
def try_get_gps_longitude(self) -> typing.Tuple[bool, float]: ...
162+
def try_get_iso_speed(self) -> int: ...
163+
def try_get_metadata_pixel_height(self) -> int: ...
164+
def try_get_metadata_pixel_width(self) -> int: ...
165+
def try_get_orientation(self) -> Orientation: ...
166+
def try_get_preview_image(self, props: PreviewProperties) -> PreviewImage: ...
167+
@staticmethod
168+
def try_get_tag_description(tag: str) -> typing.Optional[str]: ...
169+
def try_get_tag_interpreted_string(self, tag: str) -> typing.Optional[str]: ...
170+
@staticmethod
171+
def try_get_tag_label(tag: str) -> typing.Optional[str]: ...
172+
def try_get_tag_long(self, tag: str) -> int: ...
173+
def try_get_tag_multiple(self, tag: str) -> typing.Optional[list[str]]: ...
174+
def try_get_tag_raw(self, tag: str) -> typing.Optional[GLib.Bytes]: ...
175+
def try_get_tag_string(self, tag: str) -> typing.Optional[str]: ...
176+
@staticmethod
177+
def try_get_tag_type(tag: str) -> typing.Optional[str]: ...
178+
@staticmethod
179+
def try_get_xmp_namespace_for_tag(tag: str) -> str: ...
180+
def try_get_xmp_packet(self) -> typing.Optional[str]: ...
181+
def try_has_tag(self, tag: str) -> bool: ...
182+
@staticmethod
183+
def try_register_xmp_namespace(name: str, prefix: str) -> bool: ...
184+
def try_set_comment(self, comment: str) -> None: ...
185+
def try_set_exif_tag_rational(self, tag: str, nom: int, den: int) -> bool: ...
186+
def try_set_exif_thumbnail_from_buffer(
187+
self, buffer: typing.Sequence[int]
188+
) -> None: ...
189+
def try_set_gps_info(
190+
self, longitude: float, latitude: float, altitude: float
191+
) -> bool: ...
192+
def try_set_metadata_pixel_height(self, height: int) -> None: ...
193+
def try_set_metadata_pixel_width(self, width: int) -> None: ...
194+
def try_set_orientation(self, orientation: Orientation) -> None: ...
195+
def try_set_tag_long(self, tag: str, value: int) -> bool: ...
196+
def try_set_tag_multiple(self, tag: str, values: typing.Sequence[str]) -> bool: ...
197+
def try_set_tag_string(self, tag: str, value: str) -> bool: ...
198+
def try_set_xmp_tag_struct(self, tag: str, type: StructureType) -> bool: ...
199+
def try_tag_supports_multiple_values(self, tag: str) -> bool: ...
200+
@staticmethod
201+
def try_unregister_all_xmp_namespaces() -> None: ...
202+
@staticmethod
203+
def try_unregister_xmp_namespace(name: str) -> bool: ...
204+
def try_update_gps_info(
205+
self, longitude: float, latitude: float, altitude: float
206+
) -> bool: ...
207+
@staticmethod
208+
def unregister_all_xmp_namespaces() -> None: ...
209+
@staticmethod
210+
def unregister_xmp_namespace(name: str) -> bool: ...
211+
def update_gps_info(
212+
self, longitude: float, latitude: float, altitude: float
213+
) -> bool: ...
214+
215+
class MetadataClass(GObject.GPointer):
216+
"""
217+
:Constructors:
218+
219+
::
220+
221+
MetadataClass()
222+
"""
223+
224+
parent_class: GObject.ObjectClass = ...
225+
226+
class MetadataPrivate(GObject.GPointer): ...
227+
228+
class PreviewImage(GObject.Object):
229+
"""
230+
:Constructors:
231+
232+
::
233+
234+
PreviewImage(**properties)
235+
236+
Object GExiv2PreviewImage
237+
238+
Signals from GObject:
239+
notify (GParam)
240+
"""
241+
242+
parent_instance: GObject.Object = ...
243+
priv: PreviewImagePrivate = ...
244+
def free(self) -> None: ...
245+
def get_data(self) -> bytes: ...
246+
def get_extension(self) -> str: ...
247+
def get_height(self) -> int: ...
248+
def get_mime_type(self) -> str: ...
249+
def get_width(self) -> int: ...
250+
def try_write_file(self, path: str) -> int: ...
251+
def write_file(self, path: str) -> int: ...
252+
253+
class PreviewImageClass(GObject.GPointer):
254+
"""
255+
:Constructors:
256+
257+
::
258+
259+
PreviewImageClass()
260+
"""
261+
262+
parent_class: GObject.ObjectClass = ...
263+
264+
class PreviewImagePrivate(GObject.GPointer): ...
265+
266+
class PreviewProperties(GObject.Object):
267+
"""
268+
:Constructors:
269+
270+
::
271+
272+
PreviewProperties(**properties)
273+
274+
Object GExiv2PreviewProperties
275+
276+
Signals from GObject:
277+
notify (GParam)
278+
"""
279+
280+
parent_instance: GObject.Object = ...
281+
priv: PreviewPropertiesPrivate = ...
282+
def get_extension(self) -> str: ...
283+
def get_height(self) -> int: ...
284+
def get_mime_type(self) -> str: ...
285+
def get_size(self) -> int: ...
286+
def get_width(self) -> int: ...
287+
288+
class PreviewPropertiesClass(GObject.GPointer):
289+
"""
290+
:Constructors:
291+
292+
::
293+
294+
PreviewPropertiesClass()
295+
"""
296+
297+
parent_class: GObject.ObjectClass = ...
298+
299+
class PreviewPropertiesPrivate(GObject.GPointer): ...
300+
301+
class XmpFormatFlags(GObject.GFlags):
302+
EXACT_PACKET_LENGTH = 512
303+
INCLUDE_THUMBNAIL_PAD = 256
304+
OMIT_ALL_FORMATTING = 2048
305+
OMIT_PACKET_WRAPPER = 16
306+
READ_ONLY_PACKET = 32
307+
USE_COMPACT_FORMAT = 64
308+
WRITE_ALIAS_COMMENTS = 1024
309+
310+
class ByteOrder(GObject.GEnum):
311+
BIG = 1
312+
LITTLE = 0
313+
314+
class LogLevel(GObject.GEnum):
315+
DEBUG = 0
316+
ERROR = 3
317+
INFO = 1
318+
MUTE = 4
319+
WARN = 2
320+
321+
class Orientation(GObject.GEnum):
322+
HFLIP = 2
323+
NORMAL = 1
324+
ROT_180 = 3
325+
ROT_270 = 8
326+
ROT_90 = 6
327+
ROT_90_HFLIP = 5
328+
ROT_90_VFLIP = 7
329+
UNSPECIFIED = 0
330+
VFLIP = 4
331+
332+
class StructureType(GObject.GEnum):
333+
ALT = 20
334+
BAG = 21
335+
LANG = 23
336+
NONE = 0
337+
SEQ = 22

tools/update_all.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def __init__(self, name: str, version: str, *, output: str | None = None) -> Non
3030
Lib("GdkPixbuf", "2.0"),
3131
Lib("GdkX11", "4.0"),
3232
Lib("Geoclue", "2.0"),
33+
Lib("GExiv2", "0.10"),
3334
Lib("Ggit", "1.0"),
3435
Lib("Gio", "2.0"),
3536
Lib("GIRepository", "2.0"),

0 commit comments

Comments
 (0)