Added https option to getServer

Since in most place I've noticed the http field is present, I've set to return the prefix by default. We will need to add a boolean option within the configs named https.
This commit is contained in:
angelblue05 2015-03-22 05:58:02 -05:00
parent 4f9673d6e8
commit 268344a8da

View file

@ -27,7 +27,9 @@ class DownloadUtils():
TotalUrlCalls = 0
def __init__(self, *args):
self.addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
addonId = ClientInformation().getAddonId()
self.addonSettings = xbmcaddon.Addon(id=addonId)
self.addon = xbmcaddon.Addon(id=addonId)
self.getString = self.addonSettings.getLocalizedString
level = self.addonSettings.getSetting('logLevel')
self.logLevel = 0
@ -45,10 +47,30 @@ class DownloadUtils():
xbmc.log("mb3sync DownloadUtils -> " + str(msg.encode('utf-8')))
except: pass
def getServer(self):
port = self.addonSettings.getSetting('port')
host = self.addonSettings.getSetting('ipaddress')
return host + ":" + port
def getServer(self, prefix=True):
# For https support
addon = self.addon
HTTPS = addon.getSetting('https')
host = addon.getSetting('ipaddress')
port = addon.getSetting('port')
server = host + ":" + port
if len(server) < 2:
self.logMsg("No server information saved.")
return ""
# If https is true
if prefix and (HTTPS == "true"):
server = "https://%s" % server
return server
# If https is false
elif prefix and (HTTPS == "false"):
server = "http://%s" % server
return server
# If only the host:port is required
elif (prefix == False):
return server
def getUserId(self, suppress=True):