mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Added permanent users
When starting the Kodi session, will automatically add users to the session.
This commit is contained in:
parent
db45faed24
commit
f290372c5d
5 changed files with 38 additions and 3 deletions
|
@ -106,6 +106,25 @@ class DownloadUtils():
|
||||||
self.WINDOW.setProperty("sessionId%s" % self.username, sessionId)
|
self.WINDOW.setProperty("sessionId%s" % self.username, sessionId)
|
||||||
except:
|
except:
|
||||||
self.logMsg("Failed to retrieve sessionId.", 1)
|
self.logMsg("Failed to retrieve sessionId.", 1)
|
||||||
|
else:
|
||||||
|
# Post any permanent additional users
|
||||||
|
additionalUsers = utils.settings('additionalUsers').split(',')
|
||||||
|
self.logMsg("List of permanent users that should be added to the session: %s" % str(additionalUsers), 1)
|
||||||
|
# Get the user list from server to get the userId
|
||||||
|
url = "{server}/mediabrowser/Users?format=json"
|
||||||
|
result = self.downloadUrl(url)
|
||||||
|
|
||||||
|
if result:
|
||||||
|
for user in result:
|
||||||
|
username = user['Name'].lower()
|
||||||
|
userId = user['Id']
|
||||||
|
for additional in additionalUsers:
|
||||||
|
addUser = additional.decode('utf-8').lower()
|
||||||
|
if username in addUser:
|
||||||
|
url = "{server}/mediabrowser/Sessions/%s/Users/%s" % (sessionId, userId)
|
||||||
|
postdata = {}
|
||||||
|
self.downloadUrl(url, postBody=postdata, type="POST")
|
||||||
|
#xbmcgui.Dialog().notification("Success!", "%s added to viewing session" % username, time=1000)
|
||||||
|
|
||||||
def startSession(self):
|
def startSession(self):
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,9 @@ def addUser():
|
||||||
elif option == 0:
|
elif option == 0:
|
||||||
# User selected Add user
|
# User selected Add user
|
||||||
for adduser in additionalUsername:
|
for adduser in additionalUsername:
|
||||||
xbmc.log(str(adduser))
|
try: # Remove from selected already added users. It is possible they are hidden.
|
||||||
users.remove(adduser)
|
users.remove(adduser)
|
||||||
|
except: pass
|
||||||
|
|
||||||
elif option < 0:
|
elif option < 0:
|
||||||
# User cancelled
|
# User cancelled
|
||||||
|
|
|
@ -64,6 +64,13 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
return username
|
return username
|
||||||
|
|
||||||
|
def getAdditionalUsers(self):
|
||||||
|
|
||||||
|
additionalUsers = utils.settings('additionalUsers')
|
||||||
|
|
||||||
|
if additionalUsers:
|
||||||
|
self.AdditionalUser = additionalUsers.split(',')
|
||||||
|
|
||||||
def getLogLevel(self):
|
def getLogLevel(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -251,6 +258,7 @@ class UserClient(threading.Thread):
|
||||||
self.hasAccess()
|
self.hasAccess()
|
||||||
# Start DownloadUtils session
|
# Start DownloadUtils session
|
||||||
doUtils.startSession()
|
doUtils.startSession()
|
||||||
|
self.getAdditionalUsers()
|
||||||
|
|
||||||
# Set user preferences in settings
|
# Set user preferences in settings
|
||||||
self.setUserPref()
|
self.setUserPref()
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
<setting id="coverArtratio" type="bool" label="Force CoverArt Ratio" visible="eq(-1,false)" default="false" enable="true" />
|
<setting id="coverArtratio" type="bool" label="Force CoverArt Ratio" visible="eq(-1,false)" default="false" enable="true" />
|
||||||
<setting id="ignoreSpecialsNextEpisodes" type="bool" label="Ignore specials in next episodes" visible="true" enable="true" default="false" />
|
<setting id="ignoreSpecialsNextEpisodes" type="bool" label="Ignore specials in next episodes" visible="true" enable="true" default="false" />
|
||||||
<setting id="showSpecialInfoDialog" type="bool" label="Show special Emby info dialog on play" default="false" visible="false" />
|
<setting id="showSpecialInfoDialog" type="bool" label="Show special Emby info dialog on play" default="false" visible="false" />
|
||||||
|
<setting id="additionalUsers" type="text" label="Permanent users to add to the session" default="" visible="true" enable="true" />
|
||||||
</category>
|
</category>
|
||||||
<category label="30022">
|
<category label="30022">
|
||||||
<setting id="logLevel" type="enum" label="30004" values="None|Info|Debug" default="0" />
|
<setting id="logLevel" type="enum" label="30004" values="None|Info|Debug" default="0" />
|
||||||
|
|
|
@ -153,7 +153,13 @@ class Service():
|
||||||
if self.welcome_msg:
|
if self.welcome_msg:
|
||||||
# Reset authentication warnings
|
# Reset authentication warnings
|
||||||
self.welcome_msg = False
|
self.welcome_msg = False
|
||||||
xbmcgui.Dialog().notification("Emby server", "Welcome %s!" % user.currUser, icon="special://home/addons/plugin.video.emby/icon.png", time=2000, sound=False)
|
# Get additional users
|
||||||
|
additionalUsers = user.AdditionalUser
|
||||||
|
if additionalUsers:
|
||||||
|
add = ", %s" % ", ".join(additionalUsers)
|
||||||
|
else:
|
||||||
|
add = ""
|
||||||
|
xbmcgui.Dialog().notification("Emby server", "Welcome %s%s!" % (user.currUser, add), icon="special://home/addons/plugin.video.emby/icon.png", time=2000, sound=False)
|
||||||
|
|
||||||
# Start the Websocket Client
|
# Start the Websocket Client
|
||||||
if (self.newWebSocketThread is None):
|
if (self.newWebSocketThread is None):
|
||||||
|
|
Loading…
Reference in a new issue