summaryrefslogtreecommitdiffstats
path: root/gamechest/conf.py
diff options
context:
space:
mode:
Diffstat (limited to 'gamechest/conf.py')
-rw-r--r--gamechest/conf.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/gamechest/conf.py b/gamechest/conf.py
new file mode 100644
index 0000000..17e7737
--- /dev/null
+++ b/gamechest/conf.py
@@ -0,0 +1,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'