From 04377c5a9cf9b44a5c2325f94e69f9d4e3882a10 Mon Sep 17 00:00:00 2001 From: A69Tor Date: Fri, 6 May 2016 19:16:07 -0400 Subject: [PATCH] Update playutils.py Condense videoprofiles check --- resources/lib/playutils.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py index f8db1710..a1de2948 100644 --- a/resources/lib/playutils.py +++ b/resources/lib/playutils.py @@ -101,16 +101,12 @@ class PlayUtils(): videotrack = self.item['MediaSources'][0]['Name'] transcodeH265 = settings('transcodeH265') - videoprofiles = self.item['MediaSources'][0]['MediaStreams'] - streamprofiles = [] - for vprofile in videoprofiles: - if "Profile" in vprofile: - streamprofiles.append(vprofile['Profile']) + videoprofiles = [x['Profile'] for x in self.item['MediaSources'][0]['MediaStreams'] if 'Profile' in x] transcodeHi10P = utils.settings('transcodeHi10P') - - if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in streamprofiles: + + if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in videoprofiles: return False - + if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack): # Avoid H265/HEVC depending on the resolution resolution = int(videotrack.split("P", 1)[0]) @@ -215,14 +211,10 @@ class PlayUtils(): videotrack = self.item['MediaSources'][0]['Name'] transcodeH265 = utils.settings('transcodeH265') - videoprofiles = self.item['MediaSources'][0]['MediaStreams'] - streamprofiles = [] - for vprofile in videoprofiles: - if "Profile" in vprofile: - streamprofiles.append(vprofile['Profile']) + videoprofiles = [x['Profile'] for x in self.item['MediaSources'][0]['MediaStreams'] if 'Profile' in x] transcodeHi10P = utils.settings('transcodeHi10P') - - if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in streamprofiles: + + if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in videoprofiles: return False if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack):