Merge branch 'master' of 192.168.0.2:photoassistant

This commit is contained in:
2021-06-06 12:23:11 +10:00
2 changed files with 31 additions and 2 deletions

2
TODO
View File

@@ -1,6 +1,4 @@
## GENERAL
* on start up, should validate the import/storage/recycle bin paths exist and spit an error if they dont
* storage_path viewing needs to be by folder / not a big grab bag of files (by default - DONE)
-> EITHER view by folders (and hide the oldest 50 by Day section), or view flat and show it
* need a way for search results to show we found something in import_path or storage_path:

View File

@@ -1103,8 +1103,39 @@ def RemoveDups(job):
AddLogForJob(job, "adding <a href='/job/{}'>job id={} {}</a> to confirm there are no more duplicates".format( next_job.id, next_job.id, next_job.name ) )
return
def ValidateSettingsPaths():
settings = session.query(Settings).first()
rbp_exists=0
paths = settings.recycle_bin_path.split("#")
for path in paths:
if os.path.exists(path):
rbp_exists=1
break
if not rbp_exists:
print("ERROR: The bin path in settings does not exist - Please fix now");
sp_exists=0
paths = settings.storage_path.split("#")
for path in paths:
if os.path.exists(path):
sp_exists=1
break
if not sp_exists:
print("ERROR: None of the storge paths in the settings does not exist - Please fix now");
ip_exists=0
for path in paths:
if os.path.exists(path):
ip_exists=1
break
if not ip_exists:
print("ERROR: None of the import paths in the settings exist - Please fix now");
paths = settings.import_path.split("#")
return
if __name__ == "__main__":
print("INFO: PA job manager starting - listening on {}:{}".format( PA_JOB_MANAGER_HOST, PA_JOB_MANAGER_PORT) )
ValidateSettingsPaths()
# now=datetime.now(pytz.utc)
# job=Job(start_time=now, last_update=now, name="scannow", state="New", wait_for=None, pa_job_state="New", current_file_num=0, num_files=0 )