-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.py
41 lines (29 loc) · 1.03 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import argparse
import logging
import schedule
import time
from reddit2instagram import reddit, instagram, configurator
def main(args):
logger = logging.getLogger("main")
handler = [h for h in logger.handlers if h.get_name() == "console_handler"][0]
if args.verbose:
handler.setLevel(handler.level - (args.verbose * 10))
logger.debug(configurator.get_config())
downloadAndUpload()
schedule.every().hour.do(downloadAndUpload)
def downloadAndUpload():
reddit_conn = reddit.connect_reddit()
found_subs = reddit.scrape_subreddit(reddit_conn, "RocketLeague")
reddit.download_subs(found_subs)
instagram.upload_subs(found_subs)
def process_args():
parser = argparse.ArgumentParser(prog='reddit2instagram')
parser.add_argument('-v', '--verbose', action='count',
help='Increase the verbosity level of the console')
return parser.parse_args()
if __name__ == "__main__":
args = process_args()
main(args)
while True:
schedule.run_pending()
time.sleep(1)