-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigload.py
More file actions
21 lines (21 loc) · 974 Bytes
/
configload.py
File metadata and controls
21 lines (21 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os, configparser
def configload(path):
config = configparser.ConfigParser()
config.read(path)
max_inactivity = int(config['Settings']['max-inactivity'])
alarm_dir = os.path.expanduser(config['Settings']['alarm-folder'])
volume_max_command = config['Settings']['volume-max-command']
play_command = config['Settings']['play-command']
schedule_name = config['Settings']['schedule-name']
schedule = config['Settings']['schedule']
sleep_names = config['Settings']['sleep-names']
if volume_max_command == '':
print("Remember to turn the volume up to an unbearably high level!")
retdict = {"max_inactivity": max_inactivity,
"alarm_dir": alarm_dir,
"volume_max_command": volume_max_command,
"play_command": play_command,
"schedule_name": schedule_name,
"schedule": schedule,
"sleep_names": sleep_names}
return retdict