瀏覽代碼

Strip out ctrl-c handling. Too many issues.

master
rewby 8 月之前
父節點
當前提交
716c6fcd5f
共有 1 個檔案被更改,包括 3 行新增17 行删除
  1. +3
    -17
      main.py

+ 3
- 17
main.py 查看文件

@@ -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




Loading…
取消
儲存