blob: 17e7737b8de12b601b387779d8938c709f780bb4 (
plain)
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
|
#!python3
import yaml
class Config:
'''
Stores configuration for whole program run time.
Should be pretty unmuttable.
'''
def __init__(self, gamelist_path, gamedir):
self.gamelist_path = gamelist_path
self.gamedir = gamedir
# parse gamelist.yaml file; parsed once at init time and never written
# (not meat to be writtable).
with open(gamelist_path, 'r', encoding='utf8') as stream:
self.gamelist = yaml.safe_load(stream)
self.repository_host = self.gamelist['repository']['host']
self.repository_path = self.gamelist['repository']['path']
def get_status(self, game_id):
'get the status of a game by its game_id'
|