mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 09:12:58 -07:00
Move ratingKey, title, and titleSort to front of csv headers
This commit is contained in:
parent
44c643d7da
commit
2578592cc7
2 changed files with 11 additions and 0 deletions
|
@ -1728,6 +1728,9 @@ class Export(object):
|
||||||
if self.file_format == 'csv':
|
if self.file_format == 'csv':
|
||||||
csv_data = helpers.flatten_dict(result)
|
csv_data = helpers.flatten_dict(result)
|
||||||
csv_headers = sorted(set().union(*csv_data), key=helpers.sort_attrs)
|
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:
|
with open(filepath, 'w', encoding='utf-8', newline='') as outfile:
|
||||||
writer = csv.DictWriter(outfile, csv_headers)
|
writer = csv.DictWriter(outfile, csv_headers)
|
||||||
writer.writeheader()
|
writer.writeheader()
|
||||||
|
|
|
@ -1465,6 +1465,14 @@ def dict_to_xml(d, root_node=None, indent=None, level=0):
|
||||||
return xml
|
return xml
|
||||||
|
|
||||||
|
|
||||||
|
def move_to_front(l, value):
|
||||||
|
try:
|
||||||
|
l.insert(0, l.pop(l.index(value)))
|
||||||
|
except (ValueError, IndexError):
|
||||||
|
pass
|
||||||
|
return l
|
||||||
|
|
||||||
|
|
||||||
def is_hdr(bit_depth, color_space):
|
def is_hdr(bit_depth, color_space):
|
||||||
bit_depth = cast_to_int(bit_depth)
|
bit_depth = cast_to_int(bit_depth)
|
||||||
return bit_depth > 8 and color_space == 'bt2020nc'
|
return bit_depth > 8 and color_space == 'bt2020nc'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue