2024 Fixes
1) The CubeCobra CSV headers have changed slightly, capitalizing some words. 2) Cards in the maybeboard should not be included in the averages, so this filters them out. 3) Minor simplifications made to the keyword and word count analysis files to make it a bit easier for amateurs like me to figure out how to run these scripts.
This commit is contained in:
parent
4cd41ff129
commit
e17e9a349c
3 changed files with 23 additions and 13 deletions
|
|
@ -6,8 +6,10 @@ import cubecobra_csv
|
|||
import keyword_stats
|
||||
|
||||
if __name__ == '__main__':
|
||||
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')
|
||||
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')
|
||||
keyword_dict = keyword_stats.keyword_count(cube_json_filename)
|
||||
|
||||
# keyword_stats.keyword_report(keyword_dict)
|
||||
|
|
|
|||
|
|
@ -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,6 +95,7 @@ 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
|
||||
|
||||
|
|
@ -104,11 +105,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:
|
||||
|
|
@ -121,3 +122,9 @@ 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
|
||||
|
|
@ -173,8 +173,9 @@ 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
|
||||
csv_path = cubecobra_csv.request_cube_csv('TheElegantCube_fetched', 'elegant')
|
||||
cube_list = cubecobra_csv.load_cube_names(csv_path, tag_filter={'core'})
|
||||
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)
|
||||
|
||||
# 3. If you have a .txt of your cube
|
||||
# cube_list = cube_json.load_cube_from_txt('YourCubeHere.txt')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue