From 88ef0da5a609a48da55ced24fbc42d6c12eb3e80 Mon Sep 17 00:00:00 2001 From: Frederik Kriewitz Date: Sun, 12 Apr 2015 13:19:42 +0200 Subject: [PATCH] implementation of the forceTranscodingCodecs option --- resources/language/English/strings.xml | 1 + resources/lib/PlayUtils.py | 12 ++++++++++++ resources/settings.xml | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 990356ac..f4d776b5 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -244,6 +244,7 @@ Play Count Sync Indication: Enable HTTPS Use Season 100 for TV Show Specials (Requires Reset) + Force Transcoding Codecs Active diff --git a/resources/lib/PlayUtils.py b/resources/lib/PlayUtils.py index 0eb711c9..e64b7d3d 100644 --- a/resources/lib/PlayUtils.py +++ b/resources/lib/PlayUtils.py @@ -76,6 +76,18 @@ class PlayUtils(): # Works out if we are direct playing or not def isDirectPlay(self, result): + addonSettings = xbmcaddon.Addon(id='plugin.video.emby') + + # check if we should force encoding due to the forceTranscodingCodecs setting + forceTranscodingCodecs = addonSettings.getSetting('forceTranscodingCodecs') + if forceTranscodingCodecs: + forceTranscodingCodecsSet = frozenset(forceTranscodingCodecs.lower().split(',')) + codecs = frozenset([mediaStream.get('Codec', None) for mediaStream in result.get('MediaStreams', [])]) + commonCodecs = forceTranscodingCodecsSet & codecs + #xbmc.log("emby isDirectPlay MediaStreams codecs: %s forceTranscodingCodecs: %s, common: %s" % (codecs, forceTranscodingCodecsSet, commonCodecs)) + if commonCodecs: + return False + if (self.fileExists(result) or (result.get("LocationType") == "FileSystem" and self.isNetworkQualitySufficient(result) == True and self.isLocalPath(result) == False)): return True else: diff --git a/resources/settings.xml b/resources/settings.xml index 65c894f0..df8664ad 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -9,7 +9,7 @@ - +