mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-29 12:26:12 +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)
|
||||
except:
|
||||
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):
|
||||
|
||||
|
|
|
@ -98,8 +98,9 @@ def addUser():
|
|||
elif option == 0:
|
||||
# User selected Add user
|
||||
for adduser in additionalUsername:
|
||||
xbmc.log(str(adduser))
|
||||
users.remove(adduser)
|
||||
try: # Remove from selected already added users. It is possible they are hidden.
|
||||
users.remove(adduser)
|
||||
except: pass
|
||||
|
||||
elif option < 0:
|
||||
# User cancelled
|
||||
|
|
|
@ -64,6 +64,13 @@ class UserClient(threading.Thread):
|
|||
|
||||
return username
|
||||
|
||||
def getAdditionalUsers(self):
|
||||
|
||||
additionalUsers = utils.settings('additionalUsers')
|
||||
|
||||
if additionalUsers:
|
||||
self.AdditionalUser = additionalUsers.split(',')
|
||||
|
||||
def getLogLevel(self):
|
||||
|
||||
try:
|
||||
|
@ -251,6 +258,7 @@ class UserClient(threading.Thread):
|
|||
self.hasAccess()
|
||||
# Start DownloadUtils session
|
||||
doUtils.startSession()
|
||||
self.getAdditionalUsers()
|
||||
|
||||
# Set user preferences in settings
|
||||
self.setUserPref()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue