diff --git a/BUGs b/BUGs
index 3a1346f..d6e56fc 100644
--- a/BUGs
+++ b/BUGs
@@ -1,28 +1,5 @@
-### Next: 78
+### Next: 79
BUG-56: when making a viewing list of AI:mich, (any search?) and going past the page_size, it gets the wrong data from the DB for the 'next' entry
BUG-60: entries per page (in folders view) ignores pagesize, and this also contributes to BUG-56 I think
BUG-74: search/others? remembers start/offset, and if you reset view (e.g. another search) it doesnt show first page of results
BUG-77: when moving folders out from a parent folder (storage/2020 off-camera-to-oct), it did not delete the empty 2020 off-camera-to-oct folder
-BUG-78: restoring files tried to delete .pa_bin dir (and some subdirs, but files were actually in there still from a PREVIOUS del now not in the DB)
- RUNNING job: id=22 name=restore_files wait_for=None
- DEBUG: INFO: Starting Restore Files job...
- DEBUG: Restored file: copy1.jpg to static/Import/new_img_dir
- CleanUpDirInDB(): checking dir: static/Bin/.pa_bin/Import/new_img_dir (40)
- There is content (first entry: copy2.jpg) in static/Bin/.pa_bin/Import/new_img_dir - finished for this dir
- DEBUG: Restored file: copy2.jpg to static/Import/new_img_dir
- CleanUpDirInDB(): checking dir: static/Bin/.pa_bin/Import/new_img_dir (40)
- Dir static/Bin/.pa_bin/Import/new_img_dir - 40 is empty - removing it
- ERROR: Failed to remove dir from filesystem - which=static/Bin/.pa_bin/Import/new_img_dir, err: [Errno 39] Directory not empty: 'static/Bin/.pa_bin/Import/new_img_dir'
- DEBUG: INFO: Removing static/Bin/.pa_bin/Import/new_img_dir from system as removing duplicates has left it empty
- Dir static/Bin/.pa_bin/Import/new_img_dir is in static/Bin/.pa_bin/Import (39) -> check next
- CleanUpDirInDB(): checking dir: static/Bin/.pa_bin/Import (39)
- Dir static/Bin/.pa_bin/Import - 39 is empty - removing it
- ERROR: Failed to remove dir from filesystem - which=static/Bin/.pa_bin/Import, err: [Errno 39] Directory not empty: 'static/Bin/.pa_bin/Import'
- DEBUG: INFO: Removing static/Bin/.pa_bin/Import from system as removing duplicates has left it empty
- Dir static/Bin/.pa_bin/Import is in static/Bin/.pa_bin (1) -> check next
- CleanUpDirInDB(): checking dir: static/Bin/.pa_bin (1)
- Dir static/Bin/.pa_bin - 1 is empty - removing it
- ERROR: Failed to remove dir from filesystem - which=static/Bin/.pa_bin, err: [Errno 20] Not a directory: 'static/Bin/.pa_bin'
- DEBUG: INFO: Removing static/Bin/.pa_bin from system as removing duplicates has left it empty
- DEBUG: Finished restoring selected file(s)
-
diff --git a/TODO b/TODO
index d9f5b6c..9a98fc1 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,8 @@
## GENERAL
+ * CleanUpInDir()
+ * should never delete rel_path=''
+ * when it hits an error should stop and not keep cleaning
+
* only show say last week of jobs, or last 50? and archive the rest into an archived_jobs table
need scheduled jobs:
- [DONE] force scans of import/storage paths
@@ -11,6 +15,7 @@
* per file you could select an unknown face and add it as a ref img to an existing person, or make a new person and attach?
* when search, have a way to hide deleted files
+ -> not sure where to put this on GUI, its so busy...
* remember last import dir, so you can just go straight back to it
@@ -22,8 +27,6 @@
};
});
- * put a delete option on viewer page
-
* delete folder
* in Fullscreen mode and next/prev dropped out of FS when calling /viewlist route
diff --git a/pa_job_manager.py b/pa_job_manager.py
index 686ba23..c50c9b0 100644
--- a/pa_job_manager.py
+++ b/pa_job_manager.py
@@ -595,7 +595,6 @@ def CleanFileFromBin(job, e):
# use ctime as that will be when the file was moved into the Bin path
if (now - stat.st_ctime)/SECS_IN_A_DAY >= settings.bin_cleanup_file_age:
try:
- print( f"would physically remove this file: {fname}, e={e}")
os.remove( fname )
except Exception as ex:
AddLogForJob(job, f"ERROR: Tried to delete old file: {ex}" )
@@ -675,7 +674,7 @@ def RunJob(job):
elif job.name == "clean_bin":
JobCleanBin(job)
else:
- print("ERROR: Requested to process unknown job type: {}".format(job.name))
+ FinishJob(job, f"ERROR: Requested to process unknown job type: {job.name}", "Failed")
# okay, we finished a job, so check for any jobs that are dependant on this and run them...
# session.close()
if job.pa_job_state != "Completed":
@@ -733,9 +732,10 @@ def HandleJobs(first_run=False):
if job.wait_for != None:
j2 = session.query(Job).get(job.wait_for)
if not j2:
- print ("ERROR: job.wait_for ({}) does not exist in below? ".format( job.wait_for ))
+ AddLogForJob( job, f"ERROR: waiting for a job#({job.wait_for}) that does not exist? ")
+ print(f"ERROR: job.wait_for ({job.wait_for}) does not exist in below? " )
for j in session.query(Job).all():
- print ("ERROR: j={}".format(j.id))
+ print(f"ERROR: j={j.id}")
continue
if j2.pa_job_state != 'Completed':
continue
@@ -913,7 +913,7 @@ def RemoveEmtpyDirFromFS( job, del_me ):
try:
os.rmdir( del_me.FullPathOnFS() )
except Exception as e:
- print( f"ERROR: Failed to remove dir from filesystem - which={del_me.FullPathOnFS()}, err: {e}")
+ AddLogForJob( job, f"ERROR: Failed to remove dir from filesystem - which={del_me.FullPathOnFS()}, err: {e}")
return
def RemoveEmptyDirFromDB( job, del_me ):
@@ -935,12 +935,14 @@ def CleanUpDirInDB(job, e):
content = session.query(Entry).join(EntryDirLink).filter(EntryDirLink.dir_eid==e.id).first()
if not content:
print( f" Dir {e.FullPathOnFS()} - {e.id} is empty - removing it" )
+ print( f" Entry {e}" )
+ # if no in_dir, we are at the root of the path, STOP
+ if not e.in_dir:
+ print( " Parent is empty, so NEVER delete this entry, returning" )
+ return
# okay remove this empty dir
RemoveEmtpyDirFromFS( job, e )
RemoveEmptyDirFromDB( job, e )
- # if no in_dir, we are at the root of the path, STOP
- if not e.in_dir:
- return
# get an Entry from DB (in_dir is a Dir/we need the ORM entry for code to work)
parent_dir = session.query(Entry).get(e.in_dir.eid)
print( f" Dir {e.FullPathOnFS()} is in {parent_dir.FullPathOnFS()} ({parent_dir.id}) -> check next" )
@@ -984,7 +986,7 @@ def RestoreFile(job,restore_me):
dst=dst_dir + '/' + restore_me.name
os.replace( src, dst )
except Exception as e:
- print( f"ERROR: Failed to restores (mv) file on filesystem - which={src} to {dst}, err: {e}")
+ AddLogForJob( job, f"ERROR: Failed to restores (mv) file on filesystem - which={src} to {dst}, err: {e}")
# need these for AddDir calls below to work
orig_file_details = session.query(DelFile).get(restore_me.id)
@@ -1036,7 +1038,7 @@ def MoveFileToRecycleBin(job,del_me):
if DEBUG:
print( f"MoveFileToRecycleBin({job.id},{del_me.name}): os.replace {src} with {dst} " )
except Exception as e:
- print( f"ERROR: Failed to remove file from filesystem - which={src}, err: {e}")
+ AddLogForJob( job, f"ERROR: Failed to remove file from filesystem - which={src}, err: {e}")
# need these for AddDir calls below to work
bin_path=session.query(Path).join(PathType).filter(PathType.name=='Bin').first()
diff --git a/templates/viewer.html b/templates/viewer.html
index cd160bb..4e13f38 100644
--- a/templates/viewer.html
+++ b/templates/viewer.html
@@ -236,7 +236,8 @@
-