remove hardcoded /var/tmp

This commit is contained in:
Tomáš Mládek 2019-05-03 11:41:54 +02:00
parent 4ac19409b5
commit 56635b60f1

View file

@ -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'),