-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
59 lines (50 loc) · 1.47 KB
/
config.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import configparser
from os import path
camera_types_list = ["CSI", "USB"]
config = None
def initConfig():
global config
config = configparser.ConfigParser()
if path.exists('config.ini'):
config.read('config.ini')
else:
config['General'] = {
'videoType': 'Recording',
'cameraType': 'CSI',
}
config['Network'] = {
'ssid': 'test',
'password': 'password123'
}
config['Recording'] = {
'segmentSize': '1800',
'fps': '30',
'bitrate': '17000000',
'exposure': 'sports',
'audio': 'i2s',
'overlayText': "TEST\nTest 2"
}
config['Streaming'] = {
'streamLink': 'rtmp://live-iad05.twitch.tv/app/',
'fps': '30',
'bitrate': '5000000',
'audio': 'i2s',
'exposure': 'sports',
'overlayText': "TEST\nTest 2"
}
saveConfig()
def getConfig():
return config
def getRaspiMjpegConfig():
keyValMap = {}
# with open('/etc/raspimjpeg', 'r') as f:
# content = f.readlines()
# for line in content:
# if len(line) > 0 and not line.startswith('#'):
# parts = line.split()
# if len(parts) == 2:
# keyValMap[parts[0]] = parts[1]
return keyValMap
def saveConfig():
with open('config.ini', 'w') as configfile:
config.write(configfile)