From 734c562f9c726ee5f76ebc76ea07f04ca5f24968 Mon Sep 17 00:00:00 2001 From: neingeist Date: Mon, 12 Nov 2018 08:31:46 +0100 Subject: [PATCH] use another directory TMP_DIR for the downloads --- TODO.md | 1 - config.py.example | 3 ++- prolefeeder.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index a86e05b..b608092 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,3 @@ -* separate dirs for source and downloads * fix failing downloads (X-Sendfile?) * remove download after download * no seconds in the form diff --git a/config.py.example b/config.py.example index d1714bd..a55ad6d 100644 --- a/config.py.example +++ b/config.py.example @@ -4,6 +4,7 @@ import os, random, string class Config: SECRET_KEY = os.environ.get('SECRET_KEY') or \ ''.join(random.choices(string.ascii_letters, k=20)) - DATA_DIR = os.environ.get('DATA_DIR') or os.path.join(os.path.dirname(__file__), 'tmp') + DATA_DIR = os.environ.get('DATA_DIR') or os.path.join(os.path.dirname(__file__), 'data') + TMP_DIR = os.environ.get('DATA_DIR') or os.path.join(os.path.dirname(__file__), 'tmp') MAX_LENGTH = os.environ.get('MAX_LENGTH') or 180 KBITS = os.environ.get('KBITS') or 128 diff --git a/prolefeeder.py b/prolefeeder.py index 5daded2..cb10917 100644 --- a/prolefeeder.py +++ b/prolefeeder.py @@ -47,7 +47,7 @@ def download(): @app.route('/download_file/') def download_file(filename): - return send_from_directory(app.config['DATA_DIR'], filename, + return send_from_directory(app.config['TMP_DIR'], filename, as_attachment=True) @@ -93,7 +93,7 @@ def prepare_download(form): source['fn']) for source in sources])] c += ['-codec', 'copy'] c += ['-t', str(form.length.data * 60)] - c += [os.path.join(app.config['DATA_DIR'], output_filename)] + c += [os.path.join(app.config['TMP_DIR'], output_filename)] app.logger.debug(' '.join(c)) subprocess.call(c)