Compare commits

..

No commits in common. "71d1efa82b0c80daf7445efcb5ddcc54c5481e76" and "f790cafbef06667f1e224127a50fc7b529d8a5b3" have entirely different histories.

2 changed files with 1 additions and 13 deletions

View File

@ -34,7 +34,6 @@ To make this bot run at first you need to have a Python interpreter and git. Goo
Of course bot also has them. You can perform some actions with them.
* `--move-sent` - allows you to move all sent files from queue to sent directories
* `--cleanup` - purge files in both `queue` and `sent` folders if they're sent. Requires `--confirm` argument
* `--cleanup-index` - purge all sent entries from index. Requires `--confirm` argument
* `--norun` - allows you to execute above arguments without tiggering the bot start itself
Examples:

13
main.py
View File

@ -25,8 +25,7 @@ if "--move-sent" in sys.argv:
if "--cleanup" in sys.argv:
if "--confirm" in sys.argv:
index = jsonLoad(configGet("index", "locations"))
for entry in index["sent"]:
for entry in jsonLoad(configGet("index", "locations"))["sent"]:
try:
try:
os.remove(configGet("queue", "locations")+os.sep+entry)
@ -38,20 +37,10 @@ if "--cleanup" in sys.argv:
pass
except Exception as exp:
logWrite(f"Could not remove '{entry}' due to {exp}")
jsonSave(index, jsonLoad(configGet("index", "locations")))
logWrite(f"Performed cleanup of the sent files")
else:
logWrite(f"Requested cleanup of sent files but not authorized. Please pass '--confirm' to perform that")
if "--cleanup-index" in sys.argv:
if "--confirm" in sys.argv:
index = jsonLoad(configGet("index", "locations"))
index["sent"] = []
jsonSave(index, jsonLoad(configGet("index", "locations")))
logWrite(f"Performed cleanup of sent files index")
else:
logWrite(f"Requested cleanup of sent files index but not authorized. Please pass '--confirm' to perform that")
if "--norun" in sys.argv:
logWrite("Argument --norun passed, not running the main script")
sys.exit()