aboutsummaryrefslogtreecommitdiff
path: root/grab-queue
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-07-08 14:11:16 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-07-08 14:11:16 -0300
commitdc8ad39c63989c02ea7cc52ee35c861e572d605e (patch)
treea9e9ea12d5966c345633eea39eae3ec3c7328bc4 /grab-queue
parentd27f73c22edcfa1481b0804f8297ef535b6e2611 (diff)
downloadgrab-queue-dc8ad39c63989c02ea7cc52ee35c861e572d605e.tar.gz
grab-queue-dc8ad39c63989c02ea7cc52ee35c861e572d605e.tar.bz2
Fix logdir
Diffstat (limited to 'grab-queue')
-rwxr-xr-xgrab-queue18
1 files changed, 9 insertions, 9 deletions
diff --git a/grab-queue b/grab-queue
index d9959a9..54bad32 100755
--- a/grab-queue
+++ b/grab-queue
@@ -69,15 +69,15 @@ class DownloadMultiple:
# Heuristics to check if dest is a folder
if local_filename[-1] == '/':
- folder = local_filename
- log_sep = folder + '../logs/'
+ folder = local_filename
+ logdir = folder + '../logs/'
else:
- folder = os.path.dirname(local_filename)
- log_sep = ''
+ folder = os.path.dirname(local_filename)
+ logdir = ''
self.ensuredir(folder)
- with open(log_sep + 'grab-queue.log', "a") as log:
+ with open(logdir + 'grab-queue.log', "a") as log:
log.write('Downloading ' + url + '...')
# Set opts
@@ -95,7 +95,7 @@ class DownloadMultiple:
stdout, stderr = await proc.communicate()
if stdout:
- output = open(local_filename + log_sep + domain + '.stdout', 'w')
+ output = open(logdir + domain + '.stdout', 'w')
output.write(stdout.decode())
output.close()
@@ -103,18 +103,18 @@ class DownloadMultiple:
print(f'[stdout] {url} {stdout.decode()}')
if stderr:
- output = open(local_filename + log_sep + domain + '.stderr', 'w')
+ output = open(logdir + domain + '.stderr', 'w')
output.write(stderr.decode())
output.close()
if self.debug:
print(f'[stderr] {url} {stderr.decode()}')
- output = open(local_filename + log_sep + domain + '.returncode', 'w')
+ output = open(logdir + domain + '.returncode', 'w')
output.write(str(proc.returncode) + '\n')
output.close()
- output = open(local_filename + log_sep + domain + '.date', 'w')
+ output = open(logdir + domain + '.date', 'w')
output.write(str(datetime.datetime.now()) + '\n')
output.close()