From bf0d85a104a47aaf4e7a8a684e8a21315d9c4986 Mon Sep 17 00:00:00 2001 From: tech234a <46801700+tech234a@users.noreply.github.com> Date: Tue, 22 Sep 2020 17:43:30 -0400 Subject: [PATCH] HTTP uploads, file sizes --- worker.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/worker.py b/worker.py index 9f025f4..5dbd98b 100644 --- a/worker.py +++ b/worker.py @@ -290,15 +290,21 @@ while not gkiller.kill_now: print("Waiting 5 minutes...") sleep(300) - system("rsync -rltv --timeout=300 --contimeout=300 --progress --bwlimit 0 --recursive --partial --partial-dir .rsync-tmp --min-size 1 --no-compress --compress-level 0 --files-from=- directory/ "+targetloc) + if targetloc.startswith("rsync"): + system("rsync -rltv --timeout=300 --contimeout=300 --progress --bwlimit 0 --recursive --partial --partial-dir .rsync-tmp --min-size 1 --no-compress --compress-level 0 --files-from=- directory/ "+targetloc) + elif targetloc.startswith("http"): + for filzip in listdir("directory"): + if filzip.endswith(".zip"): + system("curl --data-binary @directory/"+filzip+" "+targetloc) # Report the batch as complete for itemb in batchcontent: - if isfile("out/"+itemb.split(":", 1)[1]+".zip"): - size = getsize("out/"+itemb.split(":", 1)[1]+".zip") + if isfile("directory/"+itemb.split(":", 1)[1]+".zip"): + size = getsize("directory/"+itemb.split(":", 1)[1]+".zip") else: size = 0 tracker.mark_item_as_done(itemb, size) # clear the output directory - rmtree("out") \ No newline at end of file + rmtree("out") + rmtree("directory") \ No newline at end of file