Import from GRAMPS package

svn: r1492
This commit is contained in:
Alex Roitman
2003-05-05 17:35:30 +00:00
parent 8ea5167296
commit 9993506d85
2 changed files with 164 additions and 0 deletions

View File

@ -108,6 +108,20 @@ def importData(database, filename, callback):
return 0
xml_file.close()
# Rename media files if they were conflicting with existing ones
#print parser.MediaFileMap
ObjectMap = parser.db.getObjectMap()
for OldMediaID in parser.MediaFileMap.keys():
NewMediaID = parser.MediaFileMap[OldMediaID]
oldfile = ObjectMap[NewMediaID].getPath()
oldpath = os.path.dirname(oldfile)
(junk,oldext) = os.path.splitext(os.path.basename(oldfile))
ObjectMap[NewMediaID].setPath(NewMediaID + oldext)
if NewMediaID != OldMediaID:
newfile = os.path.join( basefile, NewMediaID + oldext )
os.rename(oldfile,newfile)
return 1
#-------------------------------------------------------------------------