Commits

Julio Biason committed a2b93e8

list materials per level per discipline

Comments (0)

Files changed (1)

+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+
+import yaml
+import argparse
+
+def load_data():
+	data = yaml.load(file('collectibles.yaml'))
+	return data
+
+def args():
+	parser = argparse.ArgumentParser()
+	parser.add_argument('discipline',
+		metavar="DISCIPLINE",
+		type=str,
+		nargs='?')
+	args = parser.parse_args()
+
+	return args.discipline
+
+def main():
+	data = load_data()
+	disc = args()
+	levels = {}
+
+	for mat in data:
+		disciplines = data[mat]
+		for discipline in disciplines:
+			mat_disc = discipline['discipline']
+			mat_level = discipline['level']
+
+			if not disc == mat_disc:
+				continue
+
+			if not mat_level in levels:
+				levels[mat_level] = []
+			levels[mat_level].append(mat)
+
+	for level in sorted(levels.keys()):
+		print '{:-3} '.format(level) + ('-' * 70)
+
+		for mat in levels[level]:
+			print mat
+
+if __name__ == '__main__':
+	main()