Lib and riddle2 changes

- Added message after loop in riddle2
- Ignoring nonexistent logfile config instead of throwing an error
pull/7/head
Trivernis 6 years ago
parent 632164dba1
commit 0c64cada00

2
.gitignore vendored

@ -1,4 +1,6 @@
*.zip *.zip
*.log
logs
.idea .idea
.cache .cache
__pycache__.* __pycache__.*

@ -5,8 +5,9 @@ from lib import fsutils
def get_logger(name=None): def get_logger(name=None):
fsutils.dir_exist_guarantee('logs') if fsutils.os.path.isfile('./conf/logging.config'):
fileConfig('./conf/logging.config') fsutils.dir_exist_guarantee('logs')
fileConfig('./conf/logging.config')
if name: if name:
return logging.getLogger(name) return logging.getLogger(name)
else: else:

@ -49,7 +49,7 @@ def get_next_url(baseurl: str, url: str):
pass pass
ids = [_id for _id in ids if _id] 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 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] _id = ids[-1]
next_url = '{}/?after={}'.format(baseurl, _id) next_url = '{}/?after={}'.format(baseurl, _id)
return next_url return next_url
@ -189,6 +189,7 @@ def main():
if options.loop: if options.loop:
while True: while True:
download_subreddits(subreddits, count, output) download_subreddits(subreddits, count, output)
print('[~] Next Download in 5 minues...')
time.sleep(300) time.sleep(300)
else: else:
download_subreddits(subreddits, count, output) download_subreddits(subreddits, count, output)

Loading…
Cancel
Save