7258: Metadata viewer: Exiv2 can't handle Windows's UTF16 pathnames
So open the file and pass the handle.
This commit is contained in:
parent
94518f2577
commit
74336a7ca8
@ -178,13 +178,13 @@ class MetadataView(Gtk.TreeView):
|
|||||||
self.sections = {}
|
self.sections = {}
|
||||||
self.model.clear()
|
self.model.clear()
|
||||||
|
|
||||||
if os.path.exists(full_path):
|
if not os.path.exists(full_path):
|
||||||
|
return False
|
||||||
|
|
||||||
|
retval = False
|
||||||
|
with open(full_path, 'rb') as fd:
|
||||||
try:
|
try:
|
||||||
metadata = GExiv2.Metadata(full_path)
|
metadata = GExiv2.Metadata(self.fd)
|
||||||
except:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
get_human = metadata.get_tag_interpreted_string
|
get_human = metadata.get_tag_interpreted_string
|
||||||
|
|
||||||
@ -212,7 +212,11 @@ class MetadataView(Gtk.TreeView):
|
|||||||
self.model.add((label, human_value), node=node)
|
self.model.add((label, human_value), node=node)
|
||||||
|
|
||||||
self.model.tree.expand_all()
|
self.model.tree.expand_all()
|
||||||
return self.model.count > 0
|
retval = self.model.count > 0
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return retval
|
||||||
|
|
||||||
def __add_section(self, section):
|
def __add_section(self, section):
|
||||||
"""
|
"""
|
||||||
@ -229,15 +233,17 @@ class MetadataView(Gtk.TreeView):
|
|||||||
"""
|
"""
|
||||||
Return True if the gramplet has data, else return False.
|
Return True if the gramplet has data, else return False.
|
||||||
"""
|
"""
|
||||||
if os.path.exists(full_path):
|
if not os.path.exists(full_path):
|
||||||
|
return False
|
||||||
|
with open(full_path, 'rb') as fd:
|
||||||
|
retval = False
|
||||||
try:
|
try:
|
||||||
metadata = GExiv2.Metadata(full_path)
|
metadata = GExiv2.Metadata(fd)
|
||||||
except:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
for tag in TAGS:
|
for tag in TAGS:
|
||||||
if tag in metadata.get_exif_tags():
|
if tag in metadata.get_exif_tags():
|
||||||
return True
|
retval = True
|
||||||
return False
|
break
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return retval
|
||||||
|
Loading…
Reference in New Issue
Block a user