Compare commits

..

No commits in common. "main" and "v1.0" have entirely different histories.
main ... v1.0

3 changed files with 13 additions and 23 deletions

View file

@ -6,10 +6,8 @@ import cubecobra_csv
import keyword_stats
if __name__ == '__main__':
cube_id = 'jeskaicube'
csv_path = cubecobra_csv.request_cube_csv(cube_id, cube_id)
cube_list = cubecobra_csv.load_cube_names(f'cube_csvs/{cube_id}.csv')
cube_json_filename = cube_json.create_cube_json(cube_list, f'cubes/{cube_id}.json')
cube_list = cubecobra_csv.load_cube_names('cube_csvs/TheElegantCube_2020-11-17_5.0.4.csv', {'core'})
cube_json_filename = cube_json.create_cube_json(cube_list, 'cubes/TheElegantCube_2020-11-17_5.0.4.json')
keyword_dict = keyword_stats.keyword_count(cube_json_filename)
# keyword_stats.keyword_report(keyword_dict)

View file

@ -7,7 +7,7 @@ from typing import List, Set
import requests
EXPECTED_HEADER = [
'name',
'Name',
'CMC',
'Type',
'Color',
@ -15,12 +15,12 @@ EXPECTED_HEADER = [
'Collector Number',
'Rarity',
'Color Category',
'status',
'Status',
'Finish',
'maybeboard',
'image URL',
'image Back URL',
'tags',
'Maybeboard',
'Image URL',
'Image Back URL',
'Tags',
'Notes',
'MTGO ID'
]
@ -95,7 +95,6 @@ def load_cube(filename) -> List[CubeCard]:
tags = _get_tags(line)
color_category = _get_color_category(line)
colors = _get_colors(line)
if not _get_maybeboard(line):
cards.append(CubeCard(card_name, color_category, colors, tags))
return cards
@ -105,11 +104,11 @@ def _assert_header(header_line):
def _get_name(line: List) -> str:
return line[COLUMNS['name']]
return line[COLUMNS['Name']]
def _get_tags(line: List) -> Set[str]:
return set(t.strip() for t in line[COLUMNS['tags']].split(';'))
return set(t.strip() for t in line[COLUMNS['Tags']].split(';'))
def _get_color_category(line: List) -> str:
@ -122,9 +121,3 @@ def _get_colors(line: List) -> str:
colors = line[COLUMNS['Color']]
#assert color_category in _COLOR_CATEGORIES, f'color_category "{color_category}" unknown'
return sorted(colors.lower())
def _get_maybeboard(line: List) -> str:
maybeboard = line[COLUMNS['maybeboard']]
if 't' in maybeboard.lower():
return True
return False

View file

@ -173,9 +173,8 @@ if __name__ == '__main__':
# cube_list = cubecobra_csv.load_cube_names(csv_path)
# 2. If you have your cube in Cube Cobra and want to consider only cards with a certain tag
cube_id = 'jeskaicube'
csv_path = cubecobra_csv.request_cube_csv(cube_id, cube_id)
cube_list = cubecobra_csv.load_cube_names(csv_path, tag_filter=None)
csv_path = cubecobra_csv.request_cube_csv('TheElegantCube_fetched', 'elegant')
cube_list = cubecobra_csv.load_cube_names(csv_path, tag_filter={'core'})
# 3. If you have a .txt of your cube
# cube_list = cube_json.load_cube_from_txt('YourCubeHere.txt')