remove FixPaths until we are sure we know the bug / fix

This commit is contained in:
2021-01-21 14:28:48 +11:00
parent a716ed6007
commit bdef281d3b

View File

@@ -313,7 +313,7 @@ def SymlinkName(path, file):
# to serve static content of the images, we create a symlink from inside the static subdir of each import_path that exists # to serve static content of the images, we create a symlink from inside the static subdir of each import_path that exists
def CreateSymlink(job,path): def CreateSymlink(job,path):
symlink = FixPath('static/{}'.format( os.path.basename(path[0:-1]))) symlink=os.path.join('static', os.path.basename(path[0:-1]))
if not os.path.exists(symlink): if not os.path.exists(symlink):
os.symlink(path, symlink) os.symlink(path, symlink)
return symlink return symlink
@@ -371,7 +371,8 @@ def JobImportDir(job):
return return
else: else:
dir=AddDir(job, os.path.basename(path[0:-1]), symlink, None ) dir=AddDir(job, os.path.basename(path[0:-1]), symlink, None )
keep_dirs[FixPath(dir.path_prefix)]=dir session.commit()
keep_dirs[dir.path_prefix]=dir
import_dir=dir import_dir=dir
fcnt[symlink]=0 fcnt[symlink]=0
files = sorted(glob.glob(path + '**', recursive=True)) files = sorted(glob.glob(path + '**', recursive=True))
@@ -386,15 +387,15 @@ def JobImportDir(job):
fname=file.replace(path, "") fname=file.replace(path, "")
stat = os.stat(file) stat = os.stat(file)
dirname=SymlinkName(path, file) dirname=SymlinkName(path, file)
if stat.st_ctime > keep_dirs[FixPath(dirname)].last_import_date: if stat.st_ctime > keep_dirs[dirname].last_import_date:
if DEBUG==1: if DEBUG==1:
AddLogForJob(job, "DEBUG: {} - {} is newer than {}".format( file, stat.st_ctime, keep_dirs[FixPath(dirname)].last_import_date ), file ) AddLogForJob(job, "DEBUG: {} - {} is newer than {}".format( file, stat.st_ctime, keep_dirs[dirname].last_import_date ), file )
print("DEBUG: {} - {} is newer than {}".format( file, stat.st_ctime, keep_dirs[FixPath(dirname)].last_import_date ) ) print("DEBUG: {} - {} is newer than {}".format( file, stat.st_ctime, keep_dirs[dirname].last_import_date ) )
if os.path.isdir(file): if os.path.isdir(file):
path_prefix=os.path.join(symlink,fname) path_prefix=os.path.join(symlink,fname)
dir=AddDir( job, fname, path_prefix, dir ) dir=AddDir( job, fname, path_prefix, dir )
fcnt[path_prefix]=0 fcnt[path_prefix]=0
keep_dirs[FixPath(dir.path_prefix)]=dir keep_dirs[dir.path_prefix]=dir
else: else:
overall_file_cnt=overall_file_cnt+1 overall_file_cnt=overall_file_cnt+1
dirname=SymlinkName(path, file) dirname=SymlinkName(path, file)
@@ -409,8 +410,8 @@ def JobImportDir(job):
e=AddFile( job, os.path.basename(fname), type_str, fsize, dir ) e=AddFile( job, os.path.basename(fname), type_str, fsize, dir )
else: else:
if DEBUG==1: if DEBUG==1:
AddLogForJob(job, "DEBUG: {} - {} is OLDER than {}".format( file, stat.st_ctime, keep_dirs[FixPath(dirname)].last_import_date ), file ) AddLogForJob(job, "DEBUG: {} - {} is OLDER than {}".format( file, stat.st_ctime, keep_dirs[dirname].last_import_date ), file )
print("DEBUG: {} - {} is OLDER than {}".format( file, stat.st_ctime, keep_dirs[FixPath(dirname)].last_import_date ), file ) print("DEBUG: {} - {} is OLDER than {}".format( file, stat.st_ctime, keep_dirs[dirname].last_import_date ), file )
FinishJob(job, "Finished Importing: {} - Found {} new files".format( path, overall_file_cnt ) ) FinishJob(job, "Finished Importing: {} - Found {} new files".format( path, overall_file_cnt ) )
for d in keep_dirs: for d in keep_dirs:
keep_dirs[d].num_files = fcnt[d] keep_dirs[d].num_files = fcnt[d]
@@ -460,7 +461,7 @@ def JobGetFileDetails(job):
for jex in job.extra: for jex in job.extra:
if jex.name =="path": if jex.name =="path":
path=jex.value path=jex.value
path=FixPath('static/{}'.format( os.path.basename(path[0:-1]))) path=os.path.join('static', os.path.basename(path[0:-1]))
if DEBUG==1: if DEBUG==1:
print("DEBUG: JobGetFileDetails for path={}".format( path ) ) print("DEBUG: JobGetFileDetails for path={}".format( path ) )
dir=session.query(Dir).filter(Dir.path_prefix==path).first() dir=session.query(Dir).filter(Dir.path_prefix==path).first()