From a84902e540ccebe3ff70d1165acc548ad0bf1565 Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 11 Nov 2018 20:28:03 +0100 Subject: [PATCH] do not hardcore tmp file path --- config.py.example | 2 +- generate-test-data.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.py.example b/config.py.example index 8757916..d1714bd 100644 --- a/config.py.example +++ b/config.py.example @@ -4,6 +4,6 @@ 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 '/home/orange/devel/prolefeeder/tmp' + DATA_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/generate-test-data.py b/generate-test-data.py index 63aed88..02c9513 100644 --- a/generate-test-data.py +++ b/generate-test-data.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +import os import subprocess from config import Config @@ -18,8 +19,8 @@ delta = timedelta(hours=1) t = start while t < end: - fn = 'tmp/qfhi-{:04d}{:02d}{:02d}-{:02d}{:02d}.mp3'.format( - t.year, t.month, t.day, t.hour, t.minute) + fn = os.path.join(Config.DATA_DIR, 'qfhi-{:04d}{:02d}{:02d}-{:02d}{:02d}.mp3'.format( + t.year, t.month, t.day, t.hour, t.minute)) print(fn) generate_test_file(fn, delta)