From aa8f4195c7d096fc16db48bc4ad86def99d3a7f7 Mon Sep 17 00:00:00 2001 From: Bastiaan Welmers Date: Wed, 6 Apr 2022 19:53:29 +0200 Subject: [PATCH] Order source tags by transcoding type prio --- videodinges/views.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/videodinges/views.py b/videodinges/views.py index 0e2a938..840f0c5 100644 --- a/videodinges/views.py +++ b/videodinges/views.py @@ -37,12 +37,19 @@ def video(request: HttpRequest, slug: str) -> HttpResponse: current_quality=quality[0].quality_obj.name ) - template_data['sources'] = [ + sources = [ { 'src': _url_for(transcoding), 'type': transcoding.type, } - for transcoding in quality ] + for transcoding in quality + ] + # sort by transcoding type priority + sources.sort( + key=lambda i: models.get_transcoding_type_by_name(i['type']).priority, + reverse=True + ) + template_data['sources'] = sources template_data['used_codecs'] = [ models.get_short_name_of_transcoding_type(transcoding.type)