summaryrefslogtreecommitdiffstats
path: root/gamechestcli/gamechest/gamedb.py
diff options
context:
space:
mode:
Diffstat (limited to 'gamechestcli/gamechest/gamedb.py')
-rw-r--r--gamechestcli/gamechest/gamedb.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/gamechestcli/gamechest/gamedb.py b/gamechestcli/gamechest/gamedb.py
new file mode 100644
index 0000000..1e3967c
--- /dev/null
+++ b/gamechestcli/gamechest/gamedb.py
@@ -0,0 +1,16 @@
+import yaml
+
+from . import paths
+
+
+def load_games_database():
+ database_path = paths.get_games_database_path()
+ with open(database_path, 'rb') as fdin:
+ return yaml.safe_load(fdin)
+
+
+def get_game_info(game_id):
+ db = load_games_database()
+ return next(game_info
+ for game_info in db['games']
+ if game_info['id'] == game_id)