Allow orderby bitrate.

This commit is contained in:
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 = [ ALLOWED_ORDERBY_COLUMNS = [
'extension', 'extension',
'bitrate',
'width', 'width',
'height', 'height',
'ratio', 'ratio',

View file

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