diff --git a/TODO b/TODO index 66d6b3e..f7b84f8 100644 --- a/TODO +++ b/TODO @@ -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) -- BUG: issue with view by Day, etc. we print out day even if the Entry is not in the cwd -- TODO: Need to toggle the view if I want, and when viewing storage area, change single-click to be view file again, and right-click to be my context menu diff --git a/pa_job_manager.py b/pa_job_manager.py index adbb814..bc7766a 100644 --- a/pa_job_manager.py +++ b/pa_job_manager.py @@ -1103,8 +1103,39 @@ def RemoveDups(job): AddLogForJob(job, "adding job id={} {} 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 )