From 56635b60f1d8815fcaef91d3a5c308d94e1bcbb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Fri, 3 May 2019 11:41:54 +0200 Subject: [PATCH] remove hardcoded /var/tmp --- delojza.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/delojza.py b/delojza.py index 9e4ddcf..1789482 100755 --- a/delojza.py +++ b/delojza.py @@ -6,6 +6,7 @@ import os import re import shutil import sys +import tempfile from configparser import ConfigParser from datetime import datetime from glob import glob @@ -39,12 +40,12 @@ def datestr(date): class DelojzaBot: - def __init__(self, tg_api_key, out_dir, tmp_dir='/var/tmp', acoustid_key=None, tumblr_keys=None, markov=None): + def __init__(self, tg_api_key, out_dir, tmp_dir=None, acoustid_key=None, tumblr_keys=None, markov=None): self.logger = logging.getLogger("delojza") self.out_dir = out_dir self.logger.debug('OUT_DIR: ' + out_dir) - self.tmp_dir = tmp_dir + self.tmp_dir = tmp_dir if tmp_dir else tempfile.gettempdir() self.logger.debug('TMP_DIR: ' + tmp_dir) self.markov = markov @@ -474,7 +475,7 @@ if __name__ == '__main__': delojza = DelojzaBot(config.get('delojza', 'tg_api_key'), config.get('delojza', 'OUT_DIR', fallback=os.path.join(_DIR_, "out")), - tmp_dir=config.get('delojza', 'tmp_dir', fallback="/var/tmp"), + tmp_dir=config.get('delojza', 'tmp_dir', fallback=tempfile.gettempdir()), acoustid_key=config.get('delojza', 'acoustid_api_key'), tumblr_keys=(config.get('tumblr', 'consumer_key'), config.get('tumblr', 'consumer_secret'),