7258: Metadata viewer: Exiv2 can't handle Windows's UTF16 pathnames
So open the file and pass the handle. gramps/plugins/lib/libmetadata.py
This commit is contained in:
parent
5387cd23cf
commit
7f1a57a2cd
@ -180,13 +180,13 @@ class MetadataView(Gtk.TreeView):
|
||||
self.sections = {}
|
||||
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:
|
||||
metadata = GExiv2.Metadata(full_path)
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
metadata = GExiv2.Metadata(self.fd)
|
||||
|
||||
get_human = metadata.get_tag_interpreted_string
|
||||
|
||||
@ -214,7 +214,11 @@ class MetadataView(Gtk.TreeView):
|
||||
self.model.add((label, human_value), node=node)
|
||||
|
||||
self.model.tree.expand_all()
|
||||
return self.model.count > 0
|
||||
retval = self.model.count > 0
|
||||
except:
|
||||
pass
|
||||
|
||||
return retval
|
||||
|
||||
def __add_section(self, section):
|
||||
"""
|
||||
@ -231,15 +235,17 @@ class MetadataView(Gtk.TreeView):
|
||||
"""
|
||||
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:
|
||||
metadata = GExiv2.Metadata(full_path)
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
metadata = GExiv2.Metadata(fd)
|
||||
for tag in TAGS:
|
||||
if tag in metadata.get_exif_tags():
|
||||
return True
|
||||
return False
|
||||
retval = True
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
return retval
|
||||
|
Loading…
x
Reference in New Issue
Block a user