From f79d73440fa6b4e3f2641c86a477b5e5630d7fad Mon Sep 17 00:00:00 2001 From: vg Date: Mon, 2 Jan 2023 16:49:22 +0100 Subject: git-sync on dita --- gamechestcli/gamechest/gameconfig.py | 3 +++ gamechestcli/gamechest/gamedb.py | 8 ++++++++ gamechestcli/gamechest/statusdb.py | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+) (limited to 'gamechestcli') diff --git a/gamechestcli/gamechest/gameconfig.py b/gamechestcli/gamechest/gameconfig.py index 91f13ff..3a53837 100644 --- a/gamechestcli/gamechest/gameconfig.py +++ b/gamechestcli/gamechest/gameconfig.py @@ -65,6 +65,9 @@ class GameConfig: def get_games_database_path(self): return self.get_gamesaves_path() / 'gamedata.yaml' + def get_data_d(self): + return self.get_gamesaves_path() / 'gamedata.yaml.d' + def get_profile_id(self): return self.config['profile_id'] diff --git a/gamechestcli/gamechest/gamedb.py b/gamechestcli/gamechest/gamedb.py index 69756c1..44e0470 100644 --- a/gamechestcli/gamechest/gamedb.py +++ b/gamechestcli/gamechest/gamedb.py @@ -50,3 +50,11 @@ class GameDB: def get_ids(self): for game_info in self.db['games']: yield game_info['id'] + + def get_idtitles(self): + for game_info in self.db['games']: + yield game_info['id'], game_info['title'] + + def get_info(self, game_id): + return next(game_info for game_info in self.db['games'] + if game_info['id'] == game_id) diff --git a/gamechestcli/gamechest/statusdb.py b/gamechestcli/gamechest/statusdb.py index 4c490a2..3f2af31 100644 --- a/gamechestcli/gamechest/statusdb.py +++ b/gamechestcli/gamechest/statusdb.py @@ -19,6 +19,11 @@ class StatusDB: installed bool, version_installed text ) + --CREATE TABLE IF NOT EXISTS last_items ( + -- game_id text, + -- profile_id text, + -- type text, + --) ''') def close(self): @@ -66,6 +71,20 @@ class StatusDB: game_info['id'], )) + def set_last_played_game(self, game_id): + #cursor = self.conn.cursor() + #with self.conn: + # cursor.execute(''' + # INSERT INTO + # game_id text, + # profile_id text, + # type text, + # ''') + pass + + def set_last_played_profile(self, profile_id): + pass + def get_installed(self): for row in ( self.conn -- cgit v1.2.3