More Import cleanups

svn: r1498
This commit is contained in:
Alex Roitman 2003-05-06 04:48:51 +00:00
parent a1374f76dc
commit 98bd0706eb
3 changed files with 9 additions and 8 deletions

View File

@ -114,17 +114,18 @@ def importData(database, filename, callback):
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].setLocal(1)
if NewMediaID != OldMediaID:
if NewMediaID != OldMediaID:
oldfile = ObjectMap[NewMediaID].getPath()
oldpath = os.path.dirname(oldfile)
(junk,oldext) = os.path.splitext(os.path.basename(oldfile))
oldfile = os.path.join( basefile, OldMediaID + oldext )
newfile = os.path.join( basefile, NewMediaID + oldext )
os.rename(oldfile,newfile)
ObjectMap[NewMediaID].setPath(os.path.join(oldpath,NewMediaID+oldext))
ObjectMap[NewMediaID].setLocal(1)
return 1

View File

@ -123,7 +123,7 @@ class ReadNative:
for filename in files:
oldfile = os.path.join(tmpdir_path,filename)
newfile = os.path.join(dbdir_path,filename)
if filename != const.xmlFile:
if filename not in [const.xmlFile,const.xmlFile+'.bak']:
shutil.copy2( oldfile, newfile )
os.remove( oldfile )

View File

@ -123,7 +123,7 @@ class ReadPkg:
for filename in files:
oldfile = os.path.join(tmpdir_path,filename)
newfile = os.path.join(dbdir_path,filename)
if filename != const.xmlFile:
if filename not in [const.xmlFile,const.xmlFile+'.bak']:
shutil.copy2( oldfile, newfile )
os.remove( oldfile )