Allow orderby bitrate.

master
voussoir 2020-10-12 22:28:09 -07:00
parent 86c09aedc1
commit b2290d030a
2 changed files with 6 additions and 2 deletions

View File

@ -196,6 +196,7 @@ SQL_INDEX = sqlhelpers.reverse_table_column_map(SQL_COLUMNS)
ALLOWED_ORDERBY_COLUMNS = [
'extension',
'bitrate',
'width',
'height',
'ratio',

View File

@ -335,10 +335,13 @@ def normalize_orderby(orderby, warning_bag=None):
column = 'RANDOM()'
elif column == 'area':
column = 'width * height'
column = '(width * height)'
elif column == 'bitrate':
column = '((bytes / 128) / duration)'
elif column == 'ratio':
column = 'width / height'
column = '(width / height)'
if direction not in ('asc', 'desc'):
message = constants.WARNING_ORDERBY_BADDIRECTION.format(