From 7766e033d5bd1db108c36feefb0dab00edcb53e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jason=20=28=EC=A0=9C=EC=9D=B4=EC=8A=A8=29?= Date: Mon, 25 Jun 2018 13:54:38 -0400 Subject: [PATCH] HOTFIX : Added missing script. --- search_setup.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 search_setup.py diff --git a/search_setup.py b/search_setup.py new file mode 100644 index 0000000..6ccb051 --- /dev/null +++ b/search_setup.py @@ -0,0 +1,33 @@ +import configparser + +class ConfigReader: + search_terms = [""] + search_subreddit = "" + output_directory = "" + file_extensions = [".jpg, .png, .gif"] + url_types = [""] + search_limit = 0 + allow_nsfw = False + allow_stream = False + + def __init__(self): + print("Config Reader Module Loaded!") + + def read_config(self): + cp = configparser.ConfigParser() + cp.read('config.ini') + + # Main Config + self.search_terms = cp['Main']['search_terms'].replace(" ", "").split(',') + self.search_subreddit = cp['Main']['search_subreddit'].split()[0] + self.output_directory = cp['Main']['output_directory'].split()[0] + + # File Extensions/URL Types + self.file_extensions = cp['File Extensions']['file_extensions'].replace(" ", "").split(',') + self.url_types = cp['URL Types']['url_types'].replace(" ", "").split(',') + + # Optional + self.search_limit = int(cp['Optional']['search_limit']) + + self.allow_nsfw = cp.getboolean('Optional', 'allow_nsfw') + self.allow_stream = cp.getboolean('Optional', 'allow_stream')