From e23f6da1fb50b28f63283852dc89046b468dd644 Mon Sep 17 00:00:00 2001 From: zlg Date: Sat, 16 Oct 2021 18:26:14 -0700 Subject: vgstash: Support 'member' ownership status Games marked as a 'member' are members of a collection or bundle of *other* games. For example, Castlevania Advance Collection is available for PS4, Switch, and Xbox X, but the games contained within it are on GBA and SNES. This means the original games should be marked 'member' on ownership (and their progress tracked) while the collection entry should have its ownership tracked, but be marked unbeatable. As such, the 'owned' filter has been updated to exclude 'member' games, and there is a new 'members' filter to target *only* member games. --- src/vgstash/__init__.py | 6 ++++-- src/vgstash_cli.py | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/vgstash/__init__.py b/src/vgstash/__init__.py index 48ac055..d28e587 100755 --- a/src/vgstash/__init__.py +++ b/src/vgstash/__init__.py @@ -23,7 +23,8 @@ OWNERSHIP = { 'unowned': 0, 'physical': 1, 'digital': 2, - 'both': 3 + 'both': 3, + 'member': 4 } DEFAULT_CONFIG = { @@ -40,9 +41,10 @@ FILTERS = { 'digital': "SELECT * FROM games WHERE ownership = 2 ORDER BY system, title ASC", 'done': "SELECT * FROM games WHERE progress > 2 ORDER BY system, title ASC", 'incomplete': "SELECT * FROM games WHERE progress = 3 AND ownership > 0 ORDER BY system, title ASC", + 'members': "SELECT * FROM games WHERE ownership = 4 ORDER BY system, title ASC", 'new': "SELECT * FROM games WHERE progress = 1 ORDER BY system, title ASC", 'notes': "SELECT * FROM games WHERE notes NOT LIKE '' ORDER BY system, title ASC", - 'owned': "SELECT * FROM games WHERE ownership > 0 ORDER BY system, title ASC", + 'owned': "SELECT * FROM games WHERE ownership > 0 AND ownership < 4 ORDER BY system, title ASC", 'physical': "SELECT * FROM games WHERE ownership = 1 ORDER BY system, title ASC", 'playlog': "SELECT * FROM games WHERE ownership > 0 AND progress = 2 ORDER BY system, title ASC", 'unowned': "SELECT * FROM games WHERE ownership = 0 ORDER BY system, title ASC", diff --git a/src/vgstash_cli.py b/src/vgstash_cli.py index 1967458..7b9a9b4 100755 --- a/src/vgstash_cli.py +++ b/src/vgstash_cli.py @@ -58,7 +58,7 @@ def row_format(row, width, header): titlestr = "{: <{w}s}".format(row['title'][:twidth], w=twidth) systemstr = "{: ^8s}".format(row['system'][:8]) # unowned, physical, digital, both - ownltr = [' ', 'P', ' D', 'P D'] + ownltr = [' ', 'P', ' D', 'P D', ' M'] ownstr = "{: <3s}".format(ownltr[row['ownership']]) progltr = { 0: '', @@ -83,10 +83,11 @@ def add(title, system, ownership, progress, notes): try: db.add_game(game, update=False) own_clause = ( - "do not own", - "physically own", - "digitally own", - "digitally and physically own", + "do not own it", + "physically own it", + "digitally own it", + "digitally and physically own it", + "own it in a collection" ) progress_clause = ( "cannot beat", @@ -96,7 +97,7 @@ def add(title, system, ownership, progress, notes): "have completed", ) note_clause = "" if len(game.notes) == 0 else " It also has notes." - click.echo("Added {} for {}. You {} it and {} it.{}".format( + click.echo("Added {} for {}. You {} and {} it.{}".format( game.title, game.system, own_clause[game.ownership], -- cgit v1.2.3-54-g00ecf