Alias media info title to sort title

This commit is contained in:
JonnyWong16 2017-12-24 11:29:12 -08:00
parent 561d994328
commit c69e68a4a8
2 changed files with 12 additions and 8 deletions

View file

@ -768,13 +768,13 @@ def build_datatables_json(kwargs, dt_columns, default_sort_col=None):
# Build json data # Build json data
json_data = {"draw": 1, json_data = {"draw": 1,
"columns": columns, "columns": columns,
"order": [{"column": order_column, "order": [{"column": order_column,
"dir": kwargs.pop("order_dir", "desc")}], "dir": kwargs.pop("order_dir", "desc")}],
"start": int(kwargs.pop("start", 0)), "start": int(kwargs.pop("start", 0)),
"length": int(kwargs.pop("length", 25)), "length": int(kwargs.pop("length", 25)),
"search": {"value": kwargs.pop("search", "")} "search": {"value": kwargs.pop("search", "")}
} }
return json.dumps(json_data) return json.dumps(json_data)
def humanFileSize(bytes, si=False): def humanFileSize(bytes, si=False):

View file

@ -665,9 +665,13 @@ class WebInterface(object):
# Check if datatables json_data was received. # Check if datatables json_data was received.
# If not, then build the minimal amount of json data for a query # If not, then build the minimal amount of json data for a query
if not kwargs.get('json_data'): if not kwargs.get('json_data'):
# Alias 'title' to 'sort_title'
if kwargs.get('order_column') == 'title':
kwargs['order_column'] == 'sort_title'
# TODO: Find some one way to automatically get the columns # TODO: Find some one way to automatically get the columns
dt_columns = [("added_at", True, False), dt_columns = [("added_at", True, False),
("title", True, True), ("sort_title", True, True),
("container", True, True), ("container", True, True),
("bitrate", True, True), ("bitrate", True, True),
("video_codec", True, True), ("video_codec", True, True),
@ -678,7 +682,7 @@ class WebInterface(object):
("file_size", True, False), ("file_size", True, False),
("last_played", True, False), ("last_played", True, False),
("play_count", True, False)] ("play_count", True, False)]
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "title") kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "sort_title")
if refresh == 'true': if refresh == 'true':
refresh = True refresh = True