-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsearch_setup.py
More file actions
35 lines (28 loc) · 1.22 KB
/
Copy pathsearch_setup.py
File metadata and controls
35 lines (28 loc) · 1.22 KB
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
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
split_folders = True
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')
self.split_folders = cp.getboolean('Optional', 'split_folders')