1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-03-10 05:52:48 +00:00

IMP: Optionally force the cache directory via config.ini (note setting this to something other than {data_dir}/cache will result in no images displayed)

This commit is contained in:
evilhero 2013-01-17 11:22:51 -05:00
parent c307e6a975
commit dfa43893db
2 changed files with 8 additions and 3 deletions

View file

@ -247,6 +247,8 @@ def initialize():
LOGVERBOSE = bool(check_setting_int(CFG, 'General', 'logverbose', 1))
GIT_PATH = check_setting_str(CFG, 'General', 'git_path', '')
LOG_DIR = check_setting_str(CFG, 'General', 'log_dir', '')
if not CACHE_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))
@ -381,7 +383,9 @@ def initialize():
logger.mylar_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:
CACHE_DIR = os.path.join(str(DATA_DIR), 'cache')
logger.info("cache set to : " + str(CACHE_DIR))
if not os.path.exists(CACHE_DIR):
try:
os.makedirs(CACHE_DIR)
@ -491,6 +495,7 @@ def config_write():
new_config['General']['log_dir'] = LOG_DIR
new_config['General']['logverbose'] = int(LOGVERBOSE)
new_config['General']['git_path'] = GIT_PATH
new_config['General']['cache_dir'] = CACHE_DIR
new_config['General']['check_github'] = int(CHECK_GITHUB)
new_config['General']['check_github_on_startup'] = int(CHECK_GITHUB_ON_STARTUP)

View file

@ -42,7 +42,7 @@ def is_exists(comicid):
def addComictoDB(comicid,mismatch=None,pullupd=None):
# Putting this here to get around the circular import. Will try to use this to update images at later date.
from mylar import cache
# from mylar import cache
myDB = db.DBConnection()
@ -193,7 +193,7 @@ def addComictoDB(comicid,mismatch=None,pullupd=None):
urllib.urlretrieve(str(comic['ComicImage']), str(coverfile))
try:
with open(str(coverfile)) as f:
ComicImage = "cache/" + str(comicid) + ".jpg"
ComicImage = os.path.join('cache',str(comicid) + ".jpg")
logger.info(u"Sucessfully retrieved cover for " + str(comic['ComicName']))
#if the comic cover local is checked, save a cover.jpg to the series folder.
if mylar.COMIC_COVER_LOCAL: