summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README.mdown3
-rwxr-xr-xvgstash8
2 files changed, 9 insertions, 2 deletions
diff --git a/README.mdown b/README.mdown
index d78c9ac..a8f323d 100644
--- a/README.mdown
+++ b/README.mdown
@@ -165,6 +165,9 @@ List games that you don't own.
* **wishlist**
List games that you don't own AND are fresh.
+* **playlog**
+List games that are marked 'in-progress', that you also own.
+
* **incomplete**
List games that have been beaten, but not completed, that you also own.
diff --git a/vgstash b/vgstash
index 253c77c..54101f1 100755
--- a/vgstash
+++ b/vgstash
@@ -95,6 +95,7 @@ def init_db(args):
conn.execute("CREATE VIEW owned AS SELECT rowid,* FROM games WHERE ownership = 1 ORDER BY system,title ASC;")
conn.execute("CREATE VIEW unowned AS SELECT rowid,* FROM games WHERE ownership = 0 ORDER BY system,title ASC;")
conn.execute("CREATE VIEW wishlist AS SELECT rowid,* FROM games WHERE ownership = 0 AND progress < 2 ORDER BY system,title ASC;")
+ conn.execute("CREATE VIEW playlog AS SELECT rowid,* FROM games WHERE ownership = 1 AND progress = 1 ORDER BY system,title ASC;")
print("Views created.")
conn.commit()
except sqlite3.OperationalError as e:
@@ -283,6 +284,7 @@ def list_games(args):
# works around that limitation.
conn = sqlite3.connect(DB_LOCATION)
conn.row_factory = sqlite3.Row
+ # TODO: turn this into an object. The command parser must match filter names, so there's no reason to duplicate work.
select_stmts = {
'allgames': "SELECT * FROM allgames",
'backlog': "SELECT * FROM backlog",
@@ -292,7 +294,8 @@ def list_games(args):
'incomplete': "SELECT * FROM incomplete",
'owned': "SELECT * FROM owned",
'unowned': "SELECT * FROM unowned",
- 'wishlist': "SELECT * FROM wishlist"
+ 'wishlist': "SELECT * FROM wishlist",
+ 'playlog': "SELECT * FROM playlog"
}
# We're emulating a do-while loop
first_pass = True
@@ -379,7 +382,8 @@ def main():
# 'list' command
parser_list = subparsers.add_parser('list', help="List your games with preset views")
- list_filters = ['all', 'backlog', 'complete', 'done', 'fresh', 'incomplete', 'owned', 'unowned', 'wishlist']
+ # TODO: don't repeat yourself! The filter list is essentially copied in list_games()
+ list_filters = ['all', 'backlog', 'complete', 'done', 'fresh', 'incomplete', 'owned', 'unowned', 'wishlist', 'playlog']
parser_list.add_argument('filter', nargs='?', choices=list_filters, default='all', help='Filter games accerding to preset queries. Valid filters: {}'.format(', '.join(list_filters)))
parser_list.add_argument('-r', '--raw', action="store_true", help="Output the list in a machine-readable format, separated by pipe characters.")
parser_list.set_defaults(func=list_games)