Follow up for audio subs pref
This commit is contained in:
parent
983978dc33
commit
4d28f2a878
2 changed files with 18 additions and 5 deletions
|
@ -43,8 +43,8 @@ class Player( xbmc.Player ):
|
|||
settings = None
|
||||
playStats = {}
|
||||
|
||||
audioPref = addon.getSetting('Audiopref')
|
||||
subsPref = addon.getSetting('Subspref')
|
||||
audioPref = "default"
|
||||
subsPref = "default"
|
||||
|
||||
def __init__( self, *args ):
|
||||
|
||||
|
@ -54,7 +54,11 @@ class Player( xbmc.Player ):
|
|||
def logMsg(self, msg, lvl=1):
|
||||
|
||||
self.className = self.__class__.__name__
|
||||
utils.logMsg("%s %s" % (self.addonName, self.className), msg, int(lvl))
|
||||
utils.logMsg("%s %s" % (self.addonName, self.className), msg, int(lvl))
|
||||
|
||||
def setAudioSubsPref(self, audio, subs):
|
||||
self.audioPref = audio
|
||||
self.subsPref = subs
|
||||
|
||||
def hasData(self, data):
|
||||
if(data == None or len(data) == 0 or data == "None"):
|
||||
|
@ -223,7 +227,6 @@ class Player( xbmc.Player ):
|
|||
def onPlayBackStarted( self ):
|
||||
# Will be called when xbmc starts playing a file
|
||||
WINDOW = self.WINDOW
|
||||
self.addon = xbmcaddon.Addon(id=self.addonId)
|
||||
addon = self.addon
|
||||
xbmcplayer = self.xbmcplayer
|
||||
self.stopAll()
|
||||
|
@ -240,9 +243,14 @@ class Player( xbmc.Player ):
|
|||
|
||||
# Set audio and subtitles automatically
|
||||
# Following Emby user preference.
|
||||
if playMethod == "DirectPlay" or playMethod == "DirectStream":
|
||||
if self.audioPref == "default" and self.subsPref == "default":
|
||||
self.logMsg("No Emby user preferences found.", 2)
|
||||
# Emby user preferences are not set.
|
||||
pass
|
||||
elif playMethod == "DirectPlay" or playMethod == "DirectStream":
|
||||
# Only currently compatible with DirectPlay.
|
||||
# Tested on plugin://, unsure about direct paths.
|
||||
self.logMsg("Audio Pref: %s Subtitles Pref: %s" % (self.audioPref, self.subsPref), 1)
|
||||
audiotracks = xbmcplayer.getAvailableAudioStreams()
|
||||
subs = xbmcplayer.getAvailableSubtitleStreams()
|
||||
self.logMsg("%s %s" % (audiotracks, subs), 1)
|
||||
|
|
|
@ -15,6 +15,7 @@ import KodiMonitor
|
|||
import Utils as utils
|
||||
from ClientInformation import ClientInformation
|
||||
from DownloadUtils import DownloadUtils
|
||||
from Player import Player
|
||||
|
||||
|
||||
class UserClient(threading.Thread):
|
||||
|
@ -152,6 +153,7 @@ class UserClient(threading.Thread):
|
|||
|
||||
def setUserPref(self):
|
||||
|
||||
player = Player()
|
||||
server = self.getServer()
|
||||
userId = self.getUserId()
|
||||
addon = self.addon
|
||||
|
@ -164,6 +166,9 @@ class UserClient(threading.Thread):
|
|||
addon.setSetting('Audiopref', audio)
|
||||
addon.setSetting('Subspref', subs)
|
||||
|
||||
# Set the setting in Player
|
||||
player.setAudioSubsPref(audio.encode('utf-8'), subs.encode('utf-8'))
|
||||
|
||||
self.logMsg("Audio preference: %s" % audio, 2)
|
||||
self.logMsg("Subtitles preference: %s" % subs, 2)
|
||||
|
||||
|
|
Loading…
Reference in a new issue