Set and Clear additional user images for use in skins

This commit is contained in:
im85288 2015-10-14 19:58:32 +01:00
parent e781e9e02d
commit 79e79eddd1
2 changed files with 27 additions and 1 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby" <addon id="plugin.video.emby"
name="Emby" name="Emby"
version="1.1.48" version="1.1.49"
provider-name="Emby.media"> provider-name="Emby.media">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>

View file

@ -91,6 +91,10 @@ def addUser():
postdata = {} postdata = {}
doUtils.downloadUrl(url, postBody=postdata, type="DELETE") doUtils.downloadUrl(url, postBody=postdata, type="DELETE")
xbmcgui.Dialog().notification("Success!", "%s removed from viewing session" % selected, time=1000) xbmcgui.Dialog().notification("Success!", "%s removed from viewing session" % selected, time=1000)
# clear picture
position = WINDOW.getProperty('EmbyAdditionalUserPosition.' + selected_userId)
WINDOW.clearProperty('EmbyAdditionalUserImage.' + str(position))
return return
else: else:
return return
@ -122,6 +126,28 @@ def addUser():
xbmc.log("Failed to add user to session.") xbmc.log("Failed to add user to session.")
xbmcgui.Dialog().notification("Error", "Unable to add/remove user from the session.", xbmcgui.NOTIFICATION_ERROR) xbmcgui.Dialog().notification("Error", "Unable to add/remove user from the session.", xbmcgui.NOTIFICATION_ERROR)
try:
# Add additional user images
#always clear the individual items first
totalNodes = 10
for i in range(totalNodes):
if not WINDOW.getProperty('EmbyAdditionalUserImage.' + str(i)):
break
WINDOW.clearProperty('EmbyAdditionalUserImage.' + str(i))
url = "{server}/mediabrowser/Sessions?DeviceId=%s" % deviceId
result = doUtils.downloadUrl(url)
additionalUsers = result[0][u'AdditionalUsers']
count = 0
for additionaluser in additionalUsers:
url = "{server}/mediabrowser/Users/%s?format=json" % (additionaluser[u'UserId'])
result = doUtils.downloadUrl(url)
WINDOW.setProperty("EmbyAdditionalUserImage." + str(count),API().getUserArtwork(result,"Primary"))
WINDOW.setProperty("EmbyAdditionalUserPosition." + str(additionaluser[u'UserId']),str(count))
count +=1
except:
pass
# THEME MUSIC/VIDEOS # THEME MUSIC/VIDEOS
def getThemeMedia(): def getThemeMedia():