From 8f0343de2e49561f5d0faa9bfa1b3964f9a951fe Mon Sep 17 00:00:00 2001 From: shaun Date: Mon, 4 Jul 2016 20:34:58 +1000 Subject: [PATCH] dont auto fall back to http streaming if not selected Dont fall back to http streaming if direct file playback is expected. --- addon.xml | 2 +- resources/language/English/strings.xml | 2 +- resources/lib/playutils.py | 34 ++++++-------------------- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/addon.xml b/addon.xml index 1cd6d787..bfc2a9b4 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index d3398f18..9d583b62 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -236,7 +236,7 @@ Enter password for user: Invalid username or password Failed to authenticate too many times - Unable to direct play + Unable to direct play file Direct play failed 3 times. Enabled play from HTTP. Choose the audio stream Choose the subtitles stream diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py index 71c92696..0674be71 100644 --- a/resources/lib/playutils.py +++ b/resources/lib/playutils.py @@ -2,6 +2,8 @@ ################################################################################################# +import sys + import xbmc import xbmcgui import xbmcvfs @@ -84,8 +86,6 @@ class PlayUtils(): def isDirectPlay(self): - dialog = xbmcgui.Dialog() - # Requirement: Filesystem, Accessible path if settings('playFromStream') == "true": # User forcing to play via HTTP @@ -125,30 +125,12 @@ class PlayUtils(): # Verify the path if not self.fileExists(): log("Unable to direct play.", 1) - try: - count = int(settings('failCount')) - except ValueError: - count = 0 - log("Direct play failed: %s times." % count, 1) - - if count < 2: - # Let the user know that direct play failed - settings('failCount', value=str(count+1)) - dialog.notification( - heading=lang(29999), - message=lang(33011), - icon="special://home/addons/plugin.video.emby/icon.png", - sound=False) - elif settings('playFromStream') != "true": - # Permanently set direct stream as true - settings('playFromStream', value="true") - settings('failCount', value="0") - dialog.notification( - heading=lang(29999), - message=lang(33012), - icon="special://home/addons/plugin.video.emby/icon.png", - sound=False) - return False + log(self.directPlay(), 1) + xbmcgui.Dialog().ok( + heading=lang(29999), + line1=lang(33011), + line2=(self.directPlay())) + sys.exit() return True