From 269f6e60ae241348bb0610a0dd6b28452c0dfd67 Mon Sep 17 00:00:00 2001 From: Tim G L Lyons Date: Tue, 25 Sep 2012 18:15:13 +0000 Subject: [PATCH] 0006069: GEDCOM import does not generally support MULTIMEDIA_LINKs in the embedded form svn: r20450 --- src/plugins/lib/libgedcom.py | 41 +++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/src/plugins/lib/libgedcom.py b/src/plugins/lib/libgedcom.py index 85fde65a3..ab3aaa958 100644 --- a/src/plugins/lib/libgedcom.py +++ b/src/plugins/lib/libgedcom.py @@ -2361,6 +2361,7 @@ class GedcomParser(UpdateCallback): TOKEN_NOTE : self.__event_place_note, TOKEN_RNOTE : self.__event_place_note, TOKEN_FORM : self.__event_place_form, + # Not legal. TOKEN_OBJE : self.__event_place_object, TOKEN_SOUR : self.__event_place_sour, TOKEN__LOC : self.__ignore, @@ -4764,7 +4765,13 @@ class GedcomParser(UpdateCallback): @type state: CurrentState """ if line.data and line.data[0] == '@': - self.__not_recognized(line, state.level, state) + # Reference to a named multimedia object defined elsewhere + gramps_id = self.oid_map[line.data] + + handle = self.__find_object_handle(gramps_id) + ref = gen.lib.MediaRef() + ref.set_reference_handle(handle) + state.family.add_media_reference(ref) else: (form, filename, title, note) = self.__obje(state.level + 1, state) if filename == "": @@ -4967,7 +4974,13 @@ class GedcomParser(UpdateCallback): @type state: CurrentState """ if line.data and line.data[0] == '@': - self.__not_recognized(line, state.level, state) + # Reference to a named multimedia object defined elsewhere + gramps_id = self.oid_map[line.data] + + handle = self.__find_object_handle(gramps_id) + ref = gen.lib.MediaRef() + ref.set_reference_handle(handle) + state.event.add_media_reference(ref) else: (form, filename, title, note) = self.__obje(state.level + 1, state) if filename == "": @@ -5097,7 +5110,13 @@ class GedcomParser(UpdateCallback): @type state: CurrentState """ if line.data and line.data[0] == '@': - self.__not_recognized(line, state.level, state) + # Reference to a named multimedia object defined elsewhere + gramps_id = self.oid_map[line.data] + + handle = self.__find_object_handle(gramps_id) + ref = gen.lib.MediaRef() + ref.set_reference_handle(handle) + state.place.add_media_reference(ref) else: # FIXME this should probably be level+1 (form, filename, title, note) = self.__obje(state.level, state) @@ -5723,7 +5742,13 @@ class GedcomParser(UpdateCallback): @type state: CurrentState """ if line.data and line.data[0] == '@': - self.__not_recognized(line, state.level, state) + # Reference to a named multimedia object defined elsewhere + gramps_id = self.oid_map[line.data] + + handle = self.__find_object_handle(gramps_id) + ref = gen.lib.MediaRef() + ref.set_reference_handle(handle) + state.citation.add_media_reference(ref) else: (form, filename, title, note) = self.__obje(state.level+1, state) if filename == "": @@ -5860,7 +5885,13 @@ class GedcomParser(UpdateCallback): @type state: CurrentState """ if line.data and line.data[0] == '@': - self.__not_recognized(line, state.level, state) + # Reference to a named multimedia object defined elsewhere + gramps_id = self.oid_map[line.data] + + handle = self.__find_object_handle(gramps_id) + ref = gen.lib.MediaRef() + ref.set_reference_handle(handle) + state.source.add_media_reference(ref) else: (form, filename, title, note) = self.__obje(state.level+1, state) if filename == "":