diff --git a/mylar/__init__.py b/mylar/__init__.py index fcf07162..efb72f85 100755 --- a/mylar/__init__.py +++ b/mylar/__init__.py @@ -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) diff --git a/mylar/importer.py b/mylar/importer.py index 94aa05fe..ef006526 100755 --- a/mylar/importer.py +++ b/mylar/importer.py @@ -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: