code reduce

This commit is contained in:
SpootDev 2016-03-31 13:55:25 -05:00
parent 2748d21ff4
commit 44d0af0ad8

View file

@ -196,41 +196,33 @@ class UserClient(threading.Thread):
def setUserPref(self): def setUserPref(self):
doUtils = self.doUtils.downloadUrl doUtils = self.doUtils.downloadUrl
art = artwork.Artwork()
url = "{server}/emby/Users/{UserId}?format=json" result = doUtils("{server}/emby/Users/{UserId}?format=json")
result = doUtils(url)
self.userSettings = result self.userSettings = result
# Set user image for skin display # Set user image for skin display
if result.get('PrimaryImageTag'): if result.get('PrimaryImageTag'):
utils.window('EmbyUserImage', value=art.getUserArtwork(result['Id'], 'Primary')) utils.window('EmbyUserImage', value=artwork.Artwork().getUserArtwork(result['Id'], 'Primary'))
# Set resume point max # Set resume point max
url = "{server}/emby/System/Configuration?format=json" result = doUtils("{server}/emby/System/Configuration?format=json")
result = doUtils(url)
utils.settings('markPlayed', value=str(result['MaxResumePct'])) utils.settings('markPlayed', value=str(result['MaxResumePct']))
def getPublicUsers(self): def getPublicUsers(self):
server = self.getServer()
# Get public Users # Get public Users
url = "%s/emby/Users/Public?format=json" % server result = self.doUtils.downloadUrl("%s/emby/Users/Public?format=json" % self.getServer(), authenticate=False)
result = self.doUtils.downloadUrl(url, authenticate=False)
if result != "": if result != "":
return result return result
else: else:
# Server connection failed # Server connection failed
return False return False
def hasAccess(self): def hasAccess(self):
# hasAccess is verified in service.py # hasAccess is verified in service.py
window = utils.window window = utils.window
url = "{server}/emby/Users?format=json" result = self.doUtils.downloadUrl("{server}/emby/Users?format=json")
result = self.doUtils.downloadUrl(url)
if result == False: if result == False:
# Access is restricted, set in downloadutils.py via exception # Access is restricted, set in downloadutils.py via exception