Skip to content

Commit

Permalink
Add Image column to spreadsheet, Update spreadsheet after PR #4
Browse files Browse the repository at this point in the history
  • Loading branch information
bittner committed Jan 9, 2016
1 parent 98b0306 commit 8f0b1f6
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 247 deletions.
Binary file modified Lego-Mindstorms-Editions-Comparison.ods
Binary file not shown.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Usage
-----

#. ``Lego-Mindstorms-Editions-Comparison.ods``, a LibreOffice Calc spread sheet, lists
the pieces of all sets combined. Columns ``F`` and ``I`` tell you which pieces to
the pieces of all sets combined. Columns ``H`` and ``K`` tell you which pieces to
buy if you have either Home Edition + Expansion Set or Education Edition + Expansion
Set. You can filter the columns using the "Auto Filter" in the first row.

Expand Down
20 changes: 15 additions & 5 deletions lego-mindstorms-pieces.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
part_list = {}
part_names = {}
part_designids = {}
part_imageurls = {}
NO_PARTS = [0 for a in range(len(files))]

for file_count, name in enumerate(files):
Expand All @@ -46,6 +47,7 @@
part_list[part_no] = NO_PARTS.copy()
part_names[part_no] = part_name
part_designids[part_no] = design_id
part_imageurls[part_no] = image_url

part_list[part_no][file_count] = quantity
except ValueError as err:
Expand All @@ -55,9 +57,17 @@
part_numbers = list(part_list.keys())
part_numbers.sort()

print('Part no.\tLegoId\t%s\tPart name' % '\t'.join(files))
print('Part no.\tLego ID\t%s\tPart name\tImage' % '\t'.join(files))
for part_no in part_numbers:
part_counts = '\t'.join([str(a) for a in part_list[part_no]])
part_name = part_names[part_no]
part_legoid = part_designids[part_no]
print('%s\t%s\t%s\t%s' % (part_no, part_legoid, part_counts, part_name))
part_data = {
'partno': part_no,
'legoid': part_designids[part_no],
'counts': '\t'.join([str(a) for a in part_list[part_no]]),
'name': part_names[part_no],
'image': part_imageurls[part_no],
}
print('%(partno)s\t'
'%(legoid)s\t'
'%(counts)s\t'
'%(name)s\t'
'%(image)s' % part_data)
Loading

0 comments on commit 8f0b1f6

Please sign in to comment.