From 10a924dfbfad702125d9bb5fe972e6bdf3c6d6b2 Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Sat, 1 Sep 2012 10:21:45 -0600 Subject: [PATCH] allow setting custom cache_dir --- data/interfaces/brink/config.html | 9 +++++++++ data/interfaces/classic/config.html | 2 ++ data/interfaces/default/config.html | 4 ++++ data/interfaces/remix/config.html | 2 ++ headphones/__init__.py | 7 +++++-- headphones/webserve.py | 4 +++- 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/data/interfaces/brink/config.html b/data/interfaces/brink/config.html index 7aceed00..c92d3eaa 100644 --- a/data/interfaces/brink/config.html +++ b/data/interfaces/brink/config.html @@ -559,6 +559,15 @@ + + + + + + + + + diff --git a/data/interfaces/classic/config.html b/data/interfaces/classic/config.html index 4d2a4b16..9a5e92a3 100644 --- a/data/interfaces/classic/config.html +++ b/data/interfaces/classic/config.html @@ -342,6 +342,8 @@

Log Directory:

+

+

Cache Directory:

diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 643af20e..22e83010 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -560,6 +560,10 @@ m<%inherit file="base.html"/> +
+ + +
diff --git a/data/interfaces/remix/config.html b/data/interfaces/remix/config.html index 4d2a4b16..9a5e92a3 100644 --- a/data/interfaces/remix/config.html +++ b/data/interfaces/remix/config.html @@ -342,6 +342,8 @@

Log Directory:

+

+

Cache Directory:

diff --git a/headphones/__init__.py b/headphones/__init__.py index 0e06ba4c..ccae914e 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -296,6 +296,7 @@ def initialize(): API_KEY = check_setting_str(CFG, 'General', 'api_key', '') GIT_PATH = check_setting_str(CFG, 'General', 'git_path', '') LOG_DIR = check_setting_str(CFG, 'General', 'log_dir', '') + CACHE_DIR = check_setting_str(CFG, 'General', 'cache_dir', '') CHECK_GITHUB = bool(check_setting_int(CFG, 'General', 'check_github', 1)) CHECK_GITHUB_ON_STARTUP = bool(check_setting_int(CFG, 'General', 'check_github_on_startup', 1)) @@ -469,8 +470,9 @@ def initialize(): # Start the logger, silence console logging if we need to logger.headphones_log.initLogger(verbose=VERBOSE) - # Put the cache dir in the data dir for now - CACHE_DIR = os.path.join(DATA_DIR, 'cache') + if not CACHE_DIR: + # Put the cache dir in the data dir for now + CACHE_DIR = os.path.join(DATA_DIR, 'cache') if not os.path.exists(CACHE_DIR): try: os.makedirs(CACHE_DIR) @@ -576,6 +578,7 @@ def config_write(): new_config['General']['api_enabled'] = int(API_ENABLED) new_config['General']['api_key'] = API_KEY new_config['General']['log_dir'] = LOG_DIR + new_config['General']['cache_dir'] = CACHE_DIR new_config['General']['git_path'] = GIT_PATH new_config['General']['check_github'] = int(CHECK_GITHUB) diff --git a/headphones/webserve.py b/headphones/webserve.py index 799d84f3..2f22d247 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -486,6 +486,7 @@ class WebInterface(object): "autowant_upcoming" : checked(headphones.AUTOWANT_UPCOMING), "autowant_all" : checked(headphones.AUTOWANT_ALL), "log_dir" : headphones.LOG_DIR, + "cache_dir" : headphones.CACHE_DIR, "interface_list" : interface_list, "music_encoder": checked(headphones.MUSIC_ENCODER), "encoder": headphones.ENCODER, @@ -548,7 +549,7 @@ class WebInterface(object): numberofseeders=10, use_isohunt=0, use_kat=0, use_mininova=0, waffles=0, waffles_uid=None, waffles_passkey=None, rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, embed_lyrics=0, destination_dir=None, lossless_destination_dir=None, folder_format=None, file_format=None, include_extras=0, single=0, ep=0, compilation=0, soundtrack=0, live=0, remix=0, spokenword=0, audiobook=0, autowant_upcoming=False, autowant_all=False, - interface=None, log_dir=None, music_encoder=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, + interface=None, log_dir=None, cache_dir=None, music_encoder=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0, delete_lossless_files=0, prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=0, xbmc_enabled=0, xbmc_host=None, xbmc_username=None, xbmc_password=None, xbmc_update=0, xbmc_notify=0, nma_enabled=False, nma_apikey=None, nma_priority=0, nma_onsnatch=0, synoindex_enabled=False, mirror=None, customhost=None, customport=None, customsleep=None, hpuser=None, hppass=None, @@ -616,6 +617,7 @@ class WebInterface(object): headphones.AUTOWANT_ALL = autowant_all headphones.INTERFACE = interface headphones.LOG_DIR = log_dir + headphones.CACHE_DIR = cache_dir headphones.MUSIC_ENCODER = music_encoder headphones.ENCODER = encoder headphones.BITRATE = int(bitrate)