From 40ea27c075e81c018994f7c45f0ca98ecfef9d1b Mon Sep 17 00:00:00 2001 From: rzhxeo Date: Mon, 23 Dec 2013 05:49:36 +0100 Subject: [PATCH] Treat 'custom_sorting' in formats dict with highest priority when reordering for prefer-free-formats --- youtube_dl/YoutubeDL.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 04771c637..8301eec7b 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -683,7 +683,8 @@ class YoutubeDL(object): except ValueError: ext_ord = -1 # We only compare the extension if they have the same height and width - return (f.get('height') if f.get('height') is not None else -1, + return (f.get('custom_sorting') if f.get('custom_sorting') is not None else 0, + f.get('height') if f.get('height') is not None else -1, f.get('width') if f.get('width') is not None else -1, ext_ord) formats = sorted(formats, key=_free_formats_key)