Move ratingKey, title, and titleSort to front of csv headers

This commit is contained in:
JonnyWong16
2020-10-15 22:10:42 -07:00
parent 44c643d7da
commit 2578592cc7
2 changed files with 11 additions and 0 deletions

View File

@@ -1728,6 +1728,9 @@ class Export(object):
if self.file_format == 'csv':
csv_data = helpers.flatten_dict(result)
csv_headers = sorted(set().union(*csv_data), key=helpers.sort_attrs)
# Move ratingKey, title, and titleSort to front of headers
for key in ('titleSort', 'title', 'ratingKey'):
csv_headers = helpers.move_to_front(csv_headers, key)
with open(filepath, 'w', encoding='utf-8', newline='') as outfile:
writer = csv.DictWriter(outfile, csv_headers)
writer.writeheader()