|
|
@@ -44,23 +44,9 @@ def watch_pass(input_directory: pathlib.Path, work_directory: pathlib.Path, ia_c |
|
|
|
except FileNotFoundError: |
|
|
|
logging.warning(f"Unable to move item {original_directory}") |
|
|
|
continue |
|
|
|
try: |
|
|
|
single_impl(new_directory, ia_collection, ia_item_title, ia_item_prefix, ia_item_date, project, |
|
|
|
dispatcher, delete, backfeed_key) |
|
|
|
return True |
|
|
|
finally: |
|
|
|
# If we exit somehow without deleting, move it back. Likely ctrl+c. |
|
|
|
if new_directory.exists(): |
|
|
|
if len(list(new_directory.iterdir())) > 0: |
|
|
|
logging.warning("Stopped upload but files remain, moving back to queue...") |
|
|
|
try: |
|
|
|
new_directory.rename(original_directory) |
|
|
|
mj = original_directory.joinpath("__upload_meta.json") |
|
|
|
if mj.exists(): |
|
|
|
os.remove(mj) |
|
|
|
except FileNotFoundError: |
|
|
|
logging.warning(f"Unable to move item {new_directory}") |
|
|
|
|
|
|
|
single_impl(new_directory, ia_collection, ia_item_title, ia_item_prefix, ia_item_date, project, |
|
|
|
dispatcher, delete, backfeed_key) |
|
|
|
return True |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|