From 557d6554f08c335cabb6727017be95e1d8f66e01 Mon Sep 17 00:00:00 2001 From: Jared-02 <812543746@qq.com> Date: Mon, 25 Oct 2021 02:48:50 +0800 Subject: [PATCH] Improve the logic of choosing main or high --- helpers/Parsers/Netflix/get_manifest.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/helpers/Parsers/Netflix/get_manifest.py b/helpers/Parsers/Netflix/get_manifest.py index 464f7d2..d8939d7 100644 --- a/helpers/Parsers/Netflix/get_manifest.py +++ b/helpers/Parsers/Netflix/get_manifest.py @@ -409,13 +409,21 @@ class get_manifest: if getHigh: HighVideoList = self.HighVideoMSL() if not HighVideoList == []: - # 判断high或main,要求main比high的vamf更大的情况下选择main - # main和high的vamf相同时选择high - if int(dict(VideoList[-1])["vmaf"]) >= int(dict(HighVideoList[-1])["vmaf"]) and int(dict(VideoList[-1])["Bitrate"]) >= int(dict(HighVideoList[-1])["Bitrate"]): - check_high_or_main = "MAIN" - else: check_high_or_main = "HIGH" + # 判断main或high,要求: + # main和high的vamf不同时选择vamf更高者 + # main和high的vamf相同时选择bitrate更高者 + if dict(VideoList[-1])["vmaf"]: + if int(dict(VideoList[-1])["vmaf"]) >= int(dict(HighVideoList[-1])["vmaf"]) and int(dict(VideoList[-1])["Bitrate"]) >= int(dict(HighVideoList[-1])["Bitrate"]): + check_high_or_main = "MAIN" + else: check_high_or_main = "HIGH" + # vamf=None时,通过码率判断 + elif dict(VideoList[-1])["Bitrate"]: + if int(dict(VideoList[-1])["Bitrate"]) >= int(dict(HighVideoList[-1])["Bitrate"]): + check_high_or_main = "MAIN" + else: check_high_or_main = "HIGH" + else: self.logger.info("There was something wrong with getting manifest!") - checkerinfo = "\nNetflix Profile Checker v1.1\n2021-10-19 Jared_mod\n\nMain Rate: {}kbps | Vamf: {} | Profile: {}\nHigh Rate: {}kbps | Vamf: {} | Profile: {}\n\nResult: {} is Better!\n" + checkerinfo = "\nNetflix Profile Checker v1.1\n2021-10-25 Jared_mod\n\nMain Rate: {}kbps | Vamf: {} | Profile: {}\nHigh Rate: {}kbps | Vamf: {} | Profile: {}\n\nResult: {} is Better!\n" checkerinfo = checkerinfo.format( str(dict(VideoList[-1])["Bitrate"]), str(dict(VideoList[-1])["vmaf"]),