diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-05-15 01:30:41 +0200 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-05-15 02:47:20 +0200 |
commit | acbf9243a764dd7510502f9ad0a674517ff64c3f (patch) | |
tree | a42a33b8cf8ad4796d7f213933902aad830a722d /swiftstory/Cards.py | |
parent | eeb1aa3d0819921f7935dd73b307d69847ba779d (diff) |
Store cards as a JSON list instead of plain text
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory/Cards.py')
-rw-r--r-- | swiftstory/Cards.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/swiftstory/Cards.py b/swiftstory/Cards.py index ce54223..a2160a9 100644 --- a/swiftstory/Cards.py +++ b/swiftstory/Cards.py @@ -1,13 +1,16 @@ +import json + + class Cards: @staticmethod def get_white_cards(lang): ''' Read the file containing the white cards and return a list of cards ''' - with open('usr/share/swiftstory/lang/' + lang + '/cards/white') as fd: - return [line.strip() for line in fd] + with open('usr/share/swiftstory/lang/' + lang + '/cards/white.json') as fh: + return json.load(fh) @staticmethod def get_black_cards(lang): ''' Read the file containing the black cards and return a list of cards ''' - with open('usr/share/swiftstory/lang/' + lang + '/cards/black') as fd: - return [line.strip() for line in fd] + with open('usr/share/swiftstory/lang/' + lang + '/cards/black.json') as fh: + return json.load(fh) |