From 0c64cada00680d479a1ecb60d48c9dc4b7179718 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Tue, 20 Nov 2018 20:26:40 +0100 Subject: [PATCH] Lib and riddle2 changes - Added message after loop in riddle2 - Ignoring nonexistent logfile config instead of throwing an error --- .gitignore | 2 ++ lib/logutils.py | 5 +++-- riddle2.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4c988b5..740d98d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.zip +*.log +logs .idea .cache __pycache__.* diff --git a/lib/logutils.py b/lib/logutils.py index f45a034..8a5950c 100644 --- a/lib/logutils.py +++ b/lib/logutils.py @@ -5,8 +5,9 @@ from lib import fsutils def get_logger(name=None): - fsutils.dir_exist_guarantee('logs') - fileConfig('./conf/logging.config') + if fsutils.os.path.isfile('./conf/logging.config'): + fsutils.dir_exist_guarantee('logs') + fileConfig('./conf/logging.config') if name: return logging.getLogger(name) else: diff --git a/riddle2.py b/riddle2.py index 838b9b5..63b4990 100644 --- a/riddle2.py +++ b/riddle2.py @@ -49,7 +49,7 @@ def get_next_url(baseurl: str, url: str): pass ids = [_id for _id in ids if _id] if len(ids) == 0: # if no id was found, we can't get any further into the past - return False + return None _id = ids[-1] next_url = '{}/?after={}'.format(baseurl, _id) return next_url @@ -189,6 +189,7 @@ def main(): if options.loop: while True: download_subreddits(subreddits, count, output) + print('[~] Next Download in 5 minues...') time.sleep(300) else: download_subreddits(subreddits, count, output)